gormrepo

package
Version: v0.0.0-...-50d91fd Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2021 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type TxnDataSQL

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

TxnDataSQL manages the transaction by implementing the Transaction Manager interface

func NewTxnDataSQL

func NewTxnDataSQL(db *gorm.DB) *TxnDataSQL

NewTxnDataSQL is the contructor function

func (*TxnDataSQL) GetTxn

func (tds *TxnDataSQL) GetTxn(ctx context.Context) interface{}

GetTxn to get the current transaction of this service

func (*TxnDataSQL) TxnBegin

func (tds *TxnDataSQL) TxnBegin(ctx context.Context) context.Context

TxnBegin begin a new transaction

func (*TxnDataSQL) TxnCommit

func (tds *TxnDataSQL) TxnCommit(ctx context.Context) (err error)

TxnCommit commit a transaction

func (*TxnDataSQL) TxnRollback

func (tds *TxnDataSQL) TxnRollback(ctx context.Context) (err error)

TxnRollback rollback a transaction

type UserRepository

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

UserRepository repository struct implement the User Repository interface

func NewUserRepository

func NewUserRepository() *UserRepository

NewUserRepository creates the new instance of User Repository

func (*UserRepository) Create

func (r *UserRepository) Create(ctx context.Context, ent entity.User) (created entity.User, err error)

Create method to call DB to create the new user

func (*UserRepository) DB

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

DB to get the transaction to Database from context

func (*UserRepository) GetByID

func (r *UserRepository) GetByID(ctx context.Context, id interface{}) (ent entity.User, err error)

GetByID get the User by ID

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL