Пример #1
0
func (obj UserAccountQuery) SQL(query *bsql.QuerySQL) {
	t := reflect.TypeOf(obj)
	v := reflect.ValueOf(obj)
	for i := 0; i < t.NumField(); i++ {
		field := t.Field(i)
		tag := field.Tag
		value := v.Field(i)
		if ZeroValue(value) == false {
			query.Where(bsql.BinaryExpression(tag.Get("db"), tag.Get("query"), value.Interface()))
		}
	}
}
Пример #2
0
func (sortBy UserAccountSortBy) SQL(query *bsql.QuerySQL) {
	t := query.Table(DefaultUserAccount.TableName())
	switch sortBy.Value {
	case 1:
		query.OrderByDesc(t.Column(DefaultUserAccount.PrimaryKey()))
	case 2:
		query.OrderByAsc(t.Column(DefaultUserAccount.PrimaryKey()))
	}
}
Пример #3
0
func (page UserAccountPage) SQL(query *bsql.QuerySQL) {
	query.Page(page.No, page.Size)
}
Пример #4
0
func (page OptionPage) SQL(query *bsql.QuerySQL) {
	query.Page(page.No, page.Size)
}