Documentation ¶
Index ¶
- func Do(doc interface{}, opType operator.OpType, opts ...interface{}) error
- type CustomFields
- func (c CustomFields) CustomCreateTime(doc interface{})
- func (c CustomFields) CustomId(doc interface{})
- func (c CustomFields) CustomUpdateTime(doc interface{})
- func (c *CustomFields) SetCreateAt(fieldName string) CustomFieldsBuilder
- func (c *CustomFields) SetId(fieldName string) CustomFieldsBuilder
- func (c *CustomFields) SetUpdateAt(fieldName string) CustomFieldsBuilder
- type CustomFieldsBuilder
- type CustomFieldsHook
- type DefaultField
- type DefaultFieldHook
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
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 ¶
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 ¶
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 ¶
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