behaviors

package
v0.0.0-...-7a3883e Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2022 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

type LocalTime time.Time

LocalTime parsing and serializing time object as micro seconds number format

func (*LocalTime) FromDB

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

func (LocalTime) Now

func (lt LocalTime) Now() LocalTime

Now timestamp object

func (*LocalTime) Scan

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

func (*LocalTime) Unix

func (lt *LocalTime) Unix() int64

func (*LocalTime) Value

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

func (mb *ModifyingBehavior) BeforeInsert()

func (*ModifyingBehavior) BeforeUpdate

func (mb *ModifyingBehavior) BeforeUpdate()

type Timestamp

type Timestamp int64

func FromTimeToTimestamp

func FromTimeToTimestamp(t time.Time) Timestamp

func (*Timestamp) AutoTime

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

func (*Timestamp) FromDB

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

func (*Timestamp) Scan

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

func (Timestamp) String

func (t Timestamp) String() string

func (*Timestamp) Time

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

func (*Timestamp) ToDB

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

func (*Timestamp) Value

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