postgres

package
v0.1.0-alpha.2 Latest Latest
Warning

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

Go to latest
Published: May 12, 2022 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Inject

func Inject(container *dig.Container) error

Inject api repositories

func NewMock

func NewMock() (*sql.DB, sqlmock.Sqlmock)

func NewPSQLStatementBuilder

func NewPSQLStatementBuilder(db *sqlx.DB) squirrel.StatementBuilderType

Types

type CommonRepository

type CommonRepository interface {
	Close()
}

type OrgRepository

type OrgRepository interface {
	Create(ctx context.Context, org *domains.Org) (int64, error)
	CreateWithTx(ctx context.Context, tx *sqlx.Tx, org *domains.Org) (int64, error)
	GetByID(ctx context.Context, id int64) (*domains.Org, error)
	Fetch(ctx context.Context, p ParamsForFetchOrgs) ([]*domains.Org, int64, error)
	Update(ctx context.Context, org *domains.Org, fieldsToUpdate []string) error
	DeleteById(ctx context.Context, id int64) error
}

func NewPgsqlOrgRepository

func NewPgsqlOrgRepository(mdbi *datastore.MasterDbInstance, sdbi *datastore.SlaveDbInstance) OrgRepository

NewPgsqlOrgRepository will create new an orgRepository object representation of OrgRepository interface

type ParamsForFetchOrgs

type ParamsForFetchOrgs struct {
	defines.CommonParamsForFetch
	Ids      []int64
	Statuses []string
}

type ParamsForFetchUserOrgs

type ParamsForFetchUserOrgs struct {
	UserIds []int64
	OrgId   int64
	Emails  []string
	defines.CommonParamsForFetch
}

type ParamsForFetchUsers

type ParamsForFetchUsers struct {
	defines.CommonParamsForFetch
}

type SqlxTransaction

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

func NewSqlxTransaction

func NewSqlxTransaction(mdbi *datastore.MasterDbInstance) *SqlxTransaction

func (*SqlxTransaction) Init

func (s *SqlxTransaction) Init() *sqlx.Tx

type UserOrgRepository

type UserOrgRepository interface {
	Create(ctx context.Context, userOrg *domains.UserOrg) (int64, error)
	CreateWithTx(ctx context.Context, tx *sqlx.Tx, userOrg *domains.UserOrg) (int64, error)
	UpdateByUserIdAndOrgId(ctx context.Context, userOrg *domains.UserOrg, fieldsToUpdate []string) error
	DeleteByUserIdAndOrgId(ctx context.Context, userId, orgId int64) error
	Fetch(ctx context.Context, params ParamsForFetchUserOrgs) (rs []*domains.UserOrg, count int64, err error)
}

func NewPgsqlUserOrgRepository

func NewPgsqlUserOrgRepository(mdbi *datastore.MasterDbInstance, sdbi *datastore.SlaveDbInstance) UserOrgRepository

NewPgsqlUserOrgRepository will create new an userOrgRepository object representation of UserOrgRepository interface

type UserRepository

type UserRepository interface {
	Create(ctx context.Context, user *domains.User) (int64, error)
	GetByID(ctx context.Context, id int64) (*domains.User, error)
	Fetch(ctx context.Context, p ParamsForFetchUsers) ([]*domains.User, int64, error)
	Update(ctx context.Context, user *domains.User, fieldsToUpdate []string) error
	DeleteById(ctx context.Context, id int64) error
	GetByCode(ctx context.Context, code string) (*domains.User, error)
	GetByEmail(ctx context.Context, email string) (*domains.User, error)
}

func NewPgsqlUserRepository

func NewPgsqlUserRepository(mdbi *datastore.MasterDbInstance, sdbi *datastore.SlaveDbInstance) UserRepository

NewPgsqlUserRepository will create new an userRepository object representation of UserRepository interface

Jump to

Keyboard shortcuts

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