updater

package
v0.2.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 23, 2023 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Updater

type Updater struct {
	Tx       context.Context        // 事务上下文
	Model    interface{}            // 修改对应的模型
	Wheres   where.Wheres           // 修改的过滤条件
	Update   interface{}            // 修改的结构体值, 修改整体值时使用
	Fields   map[string]interface{} // 修改的map值, 用于修改单个或多个字段时使用
	SaveNil  bool                   // 是否保存空值, 默认不会更新类似 0,false,"" 等值
	SaveFull bool                   // 是否同时修改关联数据
	Debug    bool                   // 是否开启调试模式
	Preloads []string               // 预加载关联数据
	Omits    []string               // 修改时指定不更新的字段
	Selects  []string               // 修改时指定更新的字段
}

func New

func New() *Updater

func (*Updater) SetFields

func (u *Updater) SetFields(fields map[string]interface{}) *Updater

func (*Updater) SetModel

func (u *Updater) SetModel(model interface{}) *Updater

func (*Updater) SetOmits

func (u *Updater) SetOmits(omits []string) *Updater

func (*Updater) SetPreloads

func (u *Updater) SetPreloads(preloads ...string) *Updater

func (*Updater) SetSaveFull

func (u *Updater) SetSaveFull(saveFull bool) *Updater

func (*Updater) SetSaveNil

func (u *Updater) SetSaveNil(saveNil bool) *Updater

func (*Updater) SetTx

func (u *Updater) SetTx(tx context.Context) *Updater

func (*Updater) SetUpdate

func (u *Updater) SetUpdate(update interface{}) *Updater

func (*Updater) SetWheres

func (u *Updater) SetWheres(wheres where.Wheres) *Updater

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL