behaviors

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2023 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var MicroSecondsTimestamp = true

Functions

This section is empty.

Types

type LocalTime added in v0.2.6

type LocalTime time.Time

LocalTime parsing and serializing time object as micro seconds number format

func (*LocalTime) FromDB added in v0.2.6

func (lt *LocalTime) FromDB(value interface{}) error

func (LocalTime) Now added in v0.2.6

func (lt LocalTime) Now() LocalTime

Now timestamp object

func (*LocalTime) Scan added in v0.2.6

func (lt *LocalTime) Scan(value interface{}) error

func (*LocalTime) Unix added in v0.2.6

func (lt *LocalTime) Unix() int64

func (*LocalTime) Value added in v0.2.6

func (lt *LocalTime) Value() (driver.Value, error)

Value implements the driver Valuer interface.

type ModifyingBehavior

type ModifyingBehavior struct {
	Obsoleted bool      `xorm:"'obsoleted' Bool index comment('Obsoleted if true or 1')" json:"obsoleted"`
	Changes   int       `xorm:"'changes' version comment('Change version')" json:"changes"`
	CreatedAt Timestamp `xorm:"'created_at' BigInt index comment('Timestamp created')" json:"created_at"` // If you want to save as datetime, add DateTime in tag
	UpdatedAt Timestamp `xorm:"'updated_at' BigInt index comment('Timestamp updated')" json:"updated_at"`
	CreatedBy string    `xorm:"'created_by' Varchar(50) default('') comment('User ID that created')" json:"created_by"`
	UpdatedBy string    `xorm:"'updated_by' Varchar(50) default('') comment('User ID that updated')" json:"updated_by"`
}

ModifyingBehavior modifying behavior

func (*ModifyingBehavior) BeforeInsert added in v0.2.6

func (mb *ModifyingBehavior) BeforeInsert()

func (*ModifyingBehavior) BeforeUpdate added in v0.2.6

func (mb *ModifyingBehavior) BeforeUpdate()

type Timestamp added in v0.2.6

type Timestamp int64

func FromTimeToTimestamp added in v0.2.6

func FromTimeToTimestamp(t time.Time) Timestamp

func (*Timestamp) AutoTime added in v0.2.6

func (t *Timestamp) AutoTime(now time.Time) (interface{}, error)

func (*Timestamp) FromDB added in v0.2.6

func (t *Timestamp) FromDB(b []byte) error

func (*Timestamp) Scan added in v0.2.6

func (t *Timestamp) Scan(value interface{}) error

func (Timestamp) String added in v0.2.6

func (t Timestamp) String() string

func (*Timestamp) Time added in v0.2.6

func (t *Timestamp) Time() time.Time

func (*Timestamp) ToDB added in v0.2.6

func (t *Timestamp) ToDB() ([]byte, error)

func (*Timestamp) Value added in v0.2.6

func (t *Timestamp) Value() (driver.Value, error)

Value implements the driver Valuer interface.

Jump to

Keyboard shortcuts

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