data

package
v0.0.29 Latest Latest
Warning

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

Go to latest
Published: Jan 5, 2025 License: BSD-2-Clause Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewGorm

func NewGorm(dsn string) (*gorm.DB, error)

NewDB gorm Connecting to a Database

func Paginate

func Paginate(page, pageSize int) func(db *gorm.DB) *gorm.DB

Paginate Pagination

Types

type Data

type Data struct {
	// contains filtered or unexported fields
}

Data .

func NewData added in v0.0.4

func NewData(db *gorm.DB, logger log.Logger) (*Data, func(), error)

NewData .

func (*Data) DB

func (d *Data) DB(ctx context.Context) *gorm.DB

DB Get the database connection

func (*Data) InTx

func (d *Data) InTx(ctx context.Context, fn func(ctx context.Context) error) error

Execute the database actions in a transaction

type Transaction

type Transaction interface {
	InTx(context.Context, func(ctx context.Context) error) error
}

func NewTransaction

func NewTransaction(d *Data) Transaction

NewTransaction .

Jump to

Keyboard shortcuts

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