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
352 B
Go
23 lines
352 B
Go
4 years ago
|
package sqlgen
|
||
|
|
||
|
import (
|
||
|
"errors"
|
||
|
|
||
|
"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)
|
||
|
}
|