Skip to main content

One post tagged with "2024"

View All Tags

gskctl v0.1.0 released

· 2 min read
sskycn
GoStartKit

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