repository

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	InsertMasterUserKey = iota
	GetMasterUserByUserNameKey
	GetMasterUserByIdKey
	GetAllUsersKey
	DropUserByIdKey
)
View Source
const (
	InsertPasswordKey = iota
	GetPasswordByUserPkAndKeyKey
	UpdatePasswordByUserPkAndKeyKey
	GetAllPasswordsKey
)
View Source
const (
	InsertAppVersion = `
		INSERT INTO APP_VERSION (VERSION) VALUES (:version)
	`
	GetLatestAppVersion = `
		SELECT
			VERSION
		FROM (
			SELECT
				VERSION
			FROM
				APP_VERSION
			ORDER BY CREATED_AT DESC
		) LIMIT 1
	`
	CountVersions = `
		SELECT
			COUNT(*) AS COUNT
		FROM
			APP_VERSION
	`
)
View Source
const (
	InsertMasterUser = `
		INSERT INTO MASTER_USER (USERNAME, USER_PASSWORD) VALUES (:userName, :userPassword)
	`
	GetMasterUserByUserName = `` /* 140-byte string literal not displayed */

	GetMasterUserById = `` /* 128-byte string literal not displayed */

	GetAllUsers = `
		SELECT
			ID,
			USERNAME,
			USER_PASSWORD,
			CREATED_AT,
			UPDATED_AT
		FROM
			MASTER_USER
		WHERE 1=1
	`
	DropUserById = `
		DELETE FROM MASTER_USER
		WHERE 1=1
			AND ID = :id
	`
)
View Source
const (
	InsertPassword = `
		INSERT INTO PASSWORD_LIST (USER_PK, KEY_VALUE, PASSWORD) VALUES (:userPk, :key, :password)
	`
	GetPasswordByUserPkAndKey = `` /* 171-byte string literal not displayed */

	GetAllPasswords = `` /* 147-byte string literal not displayed */

	UpdatePasswordByUserPkAndKey = `` /* 184-byte string literal not displayed */

)
View Source
const (
	InsertDetailByPasswordListKey = `
		INSERT INTO PASSWORD_LIST_DETAIL (PASSWORD_LIST_KEY, DESCRIPTION) VALUES (:passwordListKey, :description)
	`
)

Variables

This section is empty.

Functions

func CheckAppVersion

func CheckAppVersion() error

func GetStatement added in v1.1.0

func GetStatement(ctx context.Context, statement *sqlx.NamedStmt) *sqlx.NamedStmt

func InitDB

func InitDB(db *sqlx.DB) error

func NewTxContext added in v1.1.0

func NewTxContext(ctx context.Context, tx *sqlx.Tx) context.Context

Types

type AppVersionRepository

type AppVersionRepository interface {
	CountVersions() (int, error)
	InsertAppVersion() error
	GetLatestAppVersion() (string, error)
}

func NewAppVersionRepository

func NewAppVersionRepository(db *sqlx.DB) (AppVersionRepository, error)

type MasterUserRepository

type MasterUserRepository interface {
	Insert(ctx context.Context, userName string, userPassword string) error
	GetUserByUserName(ctx context.Context, userName string) (*entity.MasterUser, error)
	GetUserById(ctx context.Context, id int) (*entity.MasterUser, error)
	GetAllUsers(ctx context.Context) ([]entity.MasterUser, error)
	DropUserById(ctx context.Context, id int) error
}

func NewMasterUserRepository

func NewMasterUserRepository(db *sqlx.DB) (MasterUserRepository, error)

type PasswordListDetailRepository added in v1.1.0

type PasswordListDetailRepository interface {
	Insert(ctx context.Context, passwordListKey int, detail string) error
}

func NewPasswordListDetailRepository added in v1.1.0

func NewPasswordListDetailRepository(db *sqlx.DB) (PasswordListDetailRepository, error)

type PasswordListRepository

type PasswordListRepository interface {
	Insert(ctx context.Context, userPk int, key string, password string) error
	GetPasswordByUserPkAndKey(ctx context.Context, userPk int, key string) (entity.PasswordList, error)
	GetAllPasswords(ctx context.Context, userPk int) ([]entity.PasswordList, error)
	UpdatePasswordByUserPkAndKey(ctx context.Context, userPk int, key string, password string) error
}

func NewPasswordListRepository

func NewPasswordListRepository(db *sqlx.DB) (PasswordListRepository, error)

type RepositoryFactory

type RepositoryFactory struct {
	AppVersionRepository         AppVersionRepository
	MasterUserRepository         MasterUserRepository
	PasswordListRepository       PasswordListRepository
	PasswordListDetailRepository PasswordListDetailRepository
	TxManager                    TxManager
}

func GetRepositoryFactory

func GetRepositoryFactory() (*RepositoryFactory, error)

func NewRepositoryFactory

func NewRepositoryFactory(db *sqlx.DB) (*RepositoryFactory, error)

type TxBlock added in v1.1.0

type TxBlock func(ctx context.Context, tx *sqlx.Tx) error

type TxBlockAuto added in v1.1.0

type TxBlockAuto func(ctx context.Context) error

type TxContext added in v1.1.0

type TxContext struct {
	context.Context
	*sqlx.Tx
}

type TxManager added in v1.1.0

type TxManager interface {
	Txx(ctx context.Context, txBlock TxBlockAuto) error
	TxxWithOpt(ctx context.Context, opts *sql.TxOptions, txBlock TxBlockAuto) error
	Tx(ctx context.Context, txBlock TxBlock) error
	TxWithOpt(ctx context.Context, opts *sql.TxOptions, txBlock TxBlock) error
}

func NewTxManager added in v1.1.0

func NewTxManager(writeDB *sqlx.DB) TxManager

Jump to

Keyboard shortcuts

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