Custom Condition Field

For types of query conditions that are not currently supported, GoooQo uses the tag condition to directly write native SQL conditions:

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

Here is a sample:

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]"

Last updated