repository

package
v0.0.0-...-96417ad Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewDB

func NewDB(conf *config.AppConfig) *gorm.DB

Types

type AccountRepository

type AccountRepository interface {
	CreateAccount(info *model.Register) error
	GetAccountInfoById(userId int64) (*model.Register, error)
	GetAccountInfo(phone, email string) (*model.Register, error)
	UpdateAccountInfo(info *model.Register) error
	CreateUserInfo(user *model.UserInfo) error
	GetUserInfo(userId int64) (*model.UserInfo, error)
	UpdateUserInfo(info *model.UserInfo) error
}

func NewAccountRepository

func NewAccountRepository(repo *Repository) AccountRepository

type Repository

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

func NewRepository

func NewRepository(db *gorm.DB) *Repository

func (*Repository) DB

func (r *Repository) DB(ctx context.Context) *gorm.DB

DB return tx If you need to create a Transaction, you must call DB(ctx) and Transaction(ctx,fn)

func (*Repository) Paginate

func (r *Repository) Paginate(pageNo, pageSize int) func(db *gorm.DB) *gorm.DB

func (*Repository) Transaction

func (r *Repository) Transaction(ctx context.Context, fn func(ctx context.Context) error) error

type Transaction

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

func NewTransaction

func NewTransaction(r *Repository) Transaction

Jump to

Keyboard shortcuts

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