field

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2022 License: Apache-2.0 Imports: 6 Imported by: 12

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Do added in v0.7.1

func Do(ctx context.Context, doc interface{}, opType operator.OpType, opts ...interface{}) error

Do call the specific method to handle field based on fType Don't use opts here

Types

type CustomFields

type CustomFields struct {
	// contains filtered or unexported fields
}

CustomFields defines struct of supported custom fields

func (CustomFields) CustomCreateTime

func (c CustomFields) CustomCreateTime(doc interface{})

CustomCreateTime changes the custom create time

func (CustomFields) CustomId added in v0.7.1

func (c CustomFields) CustomId(doc interface{})

CustomUpdateTime changes the custom update time

func (CustomFields) CustomUpdateTime

func (c CustomFields) CustomUpdateTime(doc interface{})

CustomUpdateTime changes the custom update time

func (*CustomFields) SetCreateAt

func (c *CustomFields) SetCreateAt(fieldName string) CustomFieldsBuilder

SetCreateAt set the custom CreateAt field

func (*CustomFields) SetId added in v0.7.1

func (c *CustomFields) SetId(fieldName string) CustomFieldsBuilder

SetId set the custom Id field

func (*CustomFields) SetUpdateAt

func (c *CustomFields) SetUpdateAt(fieldName string) CustomFieldsBuilder

SetUpdateAt set the custom UpdateAt field

type CustomFieldsBuilder

type CustomFieldsBuilder interface {
	SetUpdateAt(fieldName string) CustomFieldsBuilder
	SetCreateAt(fieldName string) CustomFieldsBuilder
	SetId(fieldName string) CustomFieldsBuilder
}

CustomFieldsBuilder defines the interface which user use to set custom fields

func NewCustom

func NewCustom() CustomFieldsBuilder

NewCustom creates new Builder which is used to set the custom fields

type CustomFieldsHook

type CustomFieldsHook interface {
	CustomFields() CustomFieldsBuilder
}

CustomFieldsHook defines the interface, CustomFields return custom field user want to change

type DefaultField

type DefaultField struct {
	Id       primitive.ObjectID `bson:"_id"`
	CreateAt time.Time          `bson:"createAt"`
	UpdateAt time.Time          `bson:"updateAt"`
}

DefaultField defines the default fields to handle when operation happens import the DefaultField in document struct to make it working

func (*DefaultField) DefaultCreateAt

func (df *DefaultField) DefaultCreateAt()

DefaultCreateAt changes the default createAt field

func (*DefaultField) DefaultId added in v0.7.1

func (df *DefaultField) DefaultId()

DefaultCreateAt changes the default _id field

func (*DefaultField) DefaultUpdateAt

func (df *DefaultField) DefaultUpdateAt()

DefaultUpdateAt changes the default updateAt field

type DefaultFieldHook

type DefaultFieldHook interface {
	DefaultUpdateAt()
	DefaultCreateAt()
	DefaultId()
}

DefaultFieldHook defines the interface to change default fields by hook

Jump to

Keyboard shortcuts

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