自定义字段

对于目前不支持的查询条件类型,GoooQo支持使用condition标签直接编写原生SQL条件:

type UserQuery struct {
    PageQuery
    Account    *string `condition:"(username = ? OR email = ?)"`
    //...
}

示例

userQuery := UserQuery{Account: P("John")}
users, err := userDataAccess.Query(ctx, userQuery)
// SQL="SELECT id, name, score, memo, deleted FROM t_user
//   WHERE (username = ? OR email = ?)" args="[John John]"

最后更新于