gdb_model_option.go 921 B

123456789101112131415161718192021222324252627
  1. // Copyright GoFrame Author(https://github.com/gogf/gf). All Rights Reserved.
  2. //
  3. // This Source Code Form is subject to the terms of the MIT License.
  4. // If a copy of the MIT was not distributed with this file,
  5. // You can obtain one at https://github.com/gogf/gf.
  6. package gdb
  7. // Option adds extra operation option for the model.
  8. func (m *Model) Option(option int) *Model {
  9. model := m.getModel()
  10. model.option = model.option | option
  11. return model
  12. }
  13. // OptionOmitEmpty sets OPTION_OMITEMPTY option for the model, which automatically filers
  14. // the data and where attributes for empty values.
  15. // Deprecated, use OmitEmpty instead.
  16. func (m *Model) OptionOmitEmpty() *Model {
  17. return m.Option(OPTION_OMITEMPTY)
  18. }
  19. // OmitEmpty sets OPTION_OMITEMPTY option for the model, which automatically filers
  20. // the data and where attributes for empty values.
  21. func (m *Model) OmitEmpty() *Model {
  22. return m.Option(OPTION_OMITEMPTY)
  23. }