gskctl v0.1.0 released
· 2 min read
gskctl help you create app and code easy.
- create a demo app
gsk create demo
- 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 }
- config rbac
gsk config
will create/update config/rbac.go file
- 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
- build app
gsk build
will create bin/demo-$GOOS-$GOARCH
- create config.json by demo app
gsk run config
or
bin/demo-$GOOS-$GOARCH config
will create config.json
- start demo app service
gsk run serve
or
bin/demo-$GOOS-$GOARCH serve