dbo

package
v1.9.0 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2022 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DBFunction added in v1.3.10

type DBFunction func(tx ...*TxDB) (value *TxDB, err error)

func DB added in v1.3.10

func DB(db *TxDB) DBFunction

type DRIVER added in v1.1.1

type DRIVER string
const (
	DRIVER_MYSQL DRIVER = "mysql"
	DRIVER_PGSQL DRIVER = "pgsql"
)

func Driver

func Driver(opts *Options) DRIVER

type ModelType added in v1.3.3

type ModelType interface {
	*gorm.Model
}

type Null added in v1.9.0

type Null[T comparable] struct {
	Data  T
	Valid bool
}

func (Null[T]) MarshalJSON added in v1.9.0

func (n Null[T]) MarshalJSON() ([]byte, error)

func (*Null[T]) Scan added in v1.9.0

func (n *Null[T]) Scan(value any) (err error)

func (*Null[T]) UnmarshalJSON added in v1.9.0

func (n *Null[T]) UnmarshalJSON(b []byte) error

func (Null[T]) Value added in v1.9.0

func (n Null[T]) Value() (driver.Value, error)

type Options added in v1.1.1

type Options struct {
	Driver   DRIVER
	Host     string
	Port     string
	Username string
	Password string
	DBName   string
	URL      string
}

type Pagination added in v1.3.3

type Pagination[T any] struct {
	Current_page uint `json:"current_page"`
	From         uint `json:"from"`
	Last_page    uint `json:"last_page"`
	Per_page     int  `json:"per_page"`
	To           uint `json:"to"`
	Total        uint `json:"total"`
	Data         []T  `json:"data"`
}

func Paginate added in v1.3.3

func Paginate[T any](tx *gorm.DB, page uint, limit ...uint) (value *Pagination[T], err error)

type TxDB

type TxDB struct {
	*gorm.DB
	// contains filtered or unexported fields
}

func New

func New(tx *gorm.DB, opts *Options) *TxDB

func (*TxDB) New added in v1.6.0

func (tx *TxDB) New(v *gorm.DB) *TxDB

func (*TxDB) NewSession added in v1.8.2

func (tx *TxDB) NewSession() *TxDB

func (*TxDB) Preload added in v1.8.0

func (tx *TxDB) Preload(query string, args ...any) *TxDB

func (*TxDB) Scopes added in v1.6.0

func (tx *TxDB) Scopes(funcs ...TxScope) *TxDB

func (*TxDB) Transaction

func (tx *TxDB) Transaction(fn TxFunction) error

type TxFunction

type TxFunction func(tx *TxDB) error

type TxScope added in v1.6.0

type TxScope func(*gorm.DB) (tx *gorm.DB)

Jump to

Keyboard shortcuts

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