dbo

package
v1.4.2 Latest Latest
Warning

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

Go to latest
Published: Jun 16, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewSession added in v1.1.0

func NewSession(tx *gorm.DB) *gorm.DB

Types

type DBFunction added in v1.1.0

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

func DB added in v1.1.0

func DB(db *gorm.DB) DBFunction

type DRIVER

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

type Null

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

func (Null[T]) MarshalJSON

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

func (*Null[T]) Scan

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

func (*Null[T]) UnmarshalJSON

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

func (Null[T]) Value

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

type Options

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

type Pagination added in v1.1.0

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.1.0

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

Jump to

Keyboard shortcuts

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