dbo

package
v1.3.7 Latest Latest
Warning

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

Go to latest
Published: May 2, 2022 License: MIT Imports: 2 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 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) Transaction

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

type TxFunction

type TxFunction func(tx *TxDB) error

Jump to

Keyboard shortcuts

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