Documentation ¶
Index ¶
- Constants
- type IUserPostgres
- type UserPostgres
- func (userPostgres *UserPostgres) BeginTx(ctx context.Context) (tx *sql.Tx, err error)
- func (userPostgres *UserPostgres) CommitTx(tx *sql.Tx) (err error)
- func (userPostgres *UserPostgres) CreateUser(userID string, name string) (err error)
- func (userPostgres *UserPostgres) FindUserByID(userID string) (user *userEntities.User, err error)
- func (userPostgres *UserPostgres) Open() (DB *sql.DB, err error)
- func (userPostgres *UserPostgres) RollbackTx(tx *sql.Tx) (err error)
Constants ¶
View Source
const (
CreateUserDML = `INSERT INTO "user"(id, name) VALUES ($1, $2)`
)
View Source
const (
FindUserByIDDML = `SELECT id, name FROM "user" WHERE id = $1`
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type IUserPostgres ¶
type IUserPostgres interface { CreateUser(userID string, name string) (err error) FindUserByID(userID string) (user *userEntities.User, err error) interfaces.IPostgres }
func NewUserPostgres ¶
func NewUserPostgres() (userPostgres IUserPostgres, err error)
type UserPostgres ¶
type UserPostgres struct {
*commonEntities.Postgres
}
func (*UserPostgres) CreateUser ¶
func (userPostgres *UserPostgres) CreateUser(userID string, name string) (err error)
func (*UserPostgres) FindUserByID ¶
func (userPostgres *UserPostgres) FindUserByID(userID string) (user *userEntities.User, err error)
func (*UserPostgres) RollbackTx ¶
func (userPostgres *UserPostgres) RollbackTx(tx *sql.Tx) (err error)
Click to show internal directories.
Click to hide internal directories.