dao

package
v2.0.2 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2022 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Base

type Base struct {
	ID        uint64    `gorm:"primaryKey"`
	CreatedAt time.Time `gorm:"not null; index:idx_created_at"`
	UpdatedAt time.Time `gorm:"not null"`
	// contains filtered or unexported fields
}

func New

func New(opts ...Option) Base

func (Base) Context

func (m Base) Context() context.Context

func (Base) DB

func (m Base) DB(readOnly bool) *gorm.DB

func (Base) Tx

func (m Base) Tx(fn func(tx *gorm.DB) error, opts ...*sql.TxOptions) error

type Option

type Option func(*Base)

func WithContext

func WithContext(ctx context.Context) Option

func WithCreatedTime

func WithCreatedTime(timestamp time.Time) Option

func WithDB

func WithDB(ctx context.Context, tx *gorm.DB) Option

func WithPrimaryKey

func WithPrimaryKey(pk uint64) Option

func WithSnowflake

func WithSnowflake(id uint64) Option

Jump to

Keyboard shortcuts

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