dbo

package
v1.6.0 Latest Latest
Warning

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

Go to latest
Published: Jul 5, 2022 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Paginate added in v1.3.3

func Paginate[T any](tx *TxDB) (value T, err error)

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 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 ModelType] 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"`
}

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) 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