1 Star 1 Fork 1

c./goframe框架

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
gdb_model_option.go 2.99 KB
一键复制 编辑 原始数据 按行查看 历史
// 版权归GoFrame作者(https://goframe.org)所有。保留所有权利。
//
// 本源代码形式受MIT许可证条款约束。
// 如果未随本文件一同分发MIT许可证副本,
// 您可以在https://github.com/gogf/gf处获取。
// md5:a9832f33b234e3f3
package db类
const (
optionOmitNil = optionOmitNilWhere | optionOmitNilData
optionOmitEmpty = optionOmitEmptyWhere | optionOmitEmptyData
optionOmitNilDataInternal = optionOmitNilData | optionOmitNilDataList // 此选项仅用于内部的 ForDao 功能。 md5:0473e93966fb8e20
optionOmitEmptyWhere = 1 << iota // 8
optionOmitEmptyData // 16
optionOmitNilWhere // 32
optionOmitNilData // 64
optionOmitNilDataList // 128
)
// X过滤空值 为模型设置了 optionOmitEmpty 选项,该选项会自动过滤掉
// 数据和 where 参数中的 `空值`。
// md5:bf1dc800704b3324
func (m *X结构_Model) X过滤空值() *X结构_Model {
model := m.getModel()
model.option = model.option | optionOmitEmpty
return model
}
// X过滤空值条件 为模型设置 optionOmitEmptyWhere 选项,该选项会自动过滤掉 Where/Having 参数中的"空"值。
//
// 示例:
//
// Where("id", []int{}).All() -> SELECT xxx FROM xxx WHERE 0=1
// Where("name", "").All() -> SELECT xxx FROM xxx WHERE `name`=''
// OmitEmpty().Where("id", []int{}).All() -> SELECT xxx FROM xxx
// OmitEmpty().("name", "").All() -> SELECT xxx FROM xxx.
//
// md5:df62f4199a96c566
func (m *X结构_Model) X过滤空值条件() *X结构_Model {
model := m.getModel()
model.option = model.option | optionOmitEmptyWhere
return model
}
// X过滤空值数据 为模型设置 optionOmitEmptyData 选项,该选项会自动过滤掉 Data 参数中的空值。
// md5:56dab615155b1550
func (m *X结构_Model) X过滤空值数据() *X结构_Model {
model := m.getModel()
model.option = model.option | optionOmitEmptyData
return model
}
// X过滤Nil为模型设置optionOmitNil选项,该选项会自动过滤掉`nil`值的数据和where参数。
// md5:d24d4fb4b4f59068
func (m *X结构_Model) X过滤Nil() *X结构_Model {
model := m.getModel()
model.option = model.option | optionOmitNil
return model
}
// X过滤Nil条件 为模型设置了 optionOmitNilWhere 选项,该选项会自动过滤掉
// Where/Having 参数中的 `nil` 值。
// md5:b5927ba5d926adaf
func (m *X结构_Model) X过滤Nil条件() *X结构_Model {
model := m.getModel()
model.option = model.option | optionOmitNilWhere
return model
}
// X过滤Nil数据 为模型设置 optionOmitNilData 选项,该选项会自动过滤掉 Data 参数中的 `nil` 值。
// md5:e6503d524a0d8d31
func (m *X结构_Model) X过滤Nil数据() *X结构_Model {
model := m.getModel()
model.option = model.option | optionOmitNilData
return model
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/go_888/goframe.git
git@gitee.com:go_888/goframe.git
go_888
goframe
goframe框架
782a3f7170cf

搜索帮助