You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
375 B
Go
23 lines
375 B
Go
package sqlgen
|
|
|
|
import (
|
|
"errors"
|
|
|
|
"github.com/tal-tech/go-zero/tools/goctl/model/sql/gen"
|
|
)
|
|
|
|
var (
|
|
ErrCircleQuery = errors.New("circle query with other fields")
|
|
)
|
|
|
|
func Gen(in gen.OuterTable) (string, error) {
|
|
t, err := gen.TableConvert(in)
|
|
if err != nil {
|
|
if err == gen.ErrCircleQuery {
|
|
return "", ErrCircleQuery
|
|
}
|
|
return "", err
|
|
}
|
|
return gen.GenModel(t)
|
|
}
|