Custom Condition Field

Mapping

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

Example

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

Output SQL:

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