MCPcopy Index your code
hub / github.com/go-dev-frame/sponge / GenerateOne

Function GenerateOne

pkg/sql2code/sql2code.go:194–209  ·  view source on GitHub ↗

GenerateOne generate gorm code from sql, which can be obtained from parameters, files and db, with priority from highest to lowest

(args *Args)

Source from the content-addressed store, hash-verified

192
193// GenerateOne generate gorm code from sql, which can be obtained from parameters, files and db, with priority from highest to lowest
194func GenerateOne(args *Args) (string, error) {
195 codes, err := Generate(args)
196 if err != nil {
197 return "", err
198 }
199
200 if args.CodeType == "" {
201 args.CodeType = parser.CodeTypeModel // default is model code
202 }
203 out, ok := codes[args.CodeType]
204 if !ok {
205 return "", fmt.Errorf("unknown code type %s", args.CodeType)
206 }
207
208 return out, nil
209}
210
211// Generate model, json, dao, handler, proto codes
212func Generate(args *Args) (map[string]string, error) {

Callers 2

TestGenerateOneFunction · 0.85
TestGenerateErrorFunction · 0.85

Calls 2

GenerateFunction · 0.85
ErrorfMethod · 0.80

Tested by 2

TestGenerateOneFunction · 0.68
TestGenerateErrorFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…