跳到主要内容

gskctl v0.1.0 released

· 阅读需 2 分钟
sskycn
小艾科技

gskctl help you create app and code easy.

  1. create a demo app
gsk create demo
  1. create a contract entity at demo app
cd demo & gsk model contract
model/contract.go
package model

import (
"time"
)

// Contract model
// @Entity tableName="contracts"
type Contract struct {
// @PrimaryKey
ID uint64 `json:"id"`
// @DataType mysql=varchar(127)
ContractName string `json:"contractName"`
// @Comment "-1 deleted 0 pendding 1 valid"
Status int `json:"status"`
CreatedAt *time.Time `json:"createdAt"`
UpdatedAt *time.Time `json:"updatedAt"`
}

// ContractCollection Contract list
type ContractCollection []Contract

// Len return len
func (o *ContractCollection) Len() int { return len(*o) }

// Swap swap i, j
func (o *ContractCollection) Swap(i, j int) { (*o)[i], (*o)[j] = (*o)[j], (*o)[i] }

// Less compare i, j
func (o *ContractCollection) Less(i, j int) bool { return (*o)[i].ID < (*o)[j].ID }

  1. config rbac
gsk config

will create/update config/rbac.go file

  1. create code
gsk code

will create model/model_pool.go

will create repository/contract.go

will create contract/contract.go

will create proxy/contract.go

will create validator/contract.go

will create controller/contract.go

will create route/contract.go

  1. build app
 gsk build

will create bin/demo-$GOOS-$GOARCH

  1. create config.json by demo app
gsk run config

or

bin/demo-$GOOS-$GOARCH config

will create config.json

  1. start demo app service
gsk run serve

or

bin/demo-$GOOS-$GOARCH serve