contracts/helper/orm.go

33 lines
1.5 KiB
Go
Raw Normal View History

2023-04-20 16:50:48 +08:00
package helper
import (
"git.fsdpf.net/go/contracts"
2023-04-20 20:34:20 +08:00
"git.fsdpf.net/go/db"
2023-04-20 16:50:48 +08:00
)
// @title 创建关联模型
// @param t 关联类型
// @param m 关联模型
// @param rResource 链接父模型
// @param rField 连接父模型字段, 如 xx_id
// @param rForeignKey 关联外键, 如 id
type NewOrmRelation func(t contracts.RelationType, m contracts.Model, rResource, rField, rForeignKey string) contracts.Model
2023-04-20 16:50:48 +08:00
type NewOrmJoin func(t contracts.RelationType, res contracts.Resource, alias, rResource, rField, rForeignKey string) contracts.Join
type NewOrmCondition func(typ contracts.ConditionType, describe string) contracts.Condition
type NewOrmConditionExpr func(rResource, rField, token string, operator contracts.ConditionOperator, tType contracts.ConditionTokenType, ignoreEmptyParma bool) contracts.ConditionExpr
2023-04-20 22:44:01 +08:00
type NewOrmConditionFuncExpr func(rResource, rField, token string, operator contracts.ConditionOperator, tType contracts.ConditionTokenType, ignoreEmptyParma bool, fn, fnParam string) contracts.ConditionExpr
2023-04-20 16:50:48 +08:00
type NewOrmQueryWithRecursive func(pField, cField string, root any, isWithoutCondition bool, depth int) contracts.QueryWithRecursive
2023-04-20 22:44:01 +08:00
type NewOrmOrderBy func(sql string, direction contracts.OrderByDirection) contracts.OrderBy
2023-04-20 16:50:48 +08:00
2023-04-20 22:44:01 +08:00
type NewOrmGroupBy func(sql string) contracts.GroupBy
2023-04-20 20:34:20 +08:00
2023-04-20 23:44:58 +08:00
type NewOrmModel func(res contracts.Resource, code, name string) contracts.Model
2023-04-20 20:34:20 +08:00
type NewOrm func(res contracts.Resource, tx *db.Transaction) contracts.Orm