repository

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	InsertMasterUserKey = iota
	GetMasterUserByUserNameKey
	GetMasterUserByIdKey
	GetAllUsersKey
)
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
	`
)
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 */

)

Variables

This section is empty.

Functions

func CheckAppVersion

func CheckAppVersion() error

func InitDB

func InitDB(db *sqlx.DB) error

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)
}

func NewMasterUserRepository

func NewMasterUserRepository(db *sqlx.DB) (MasterUserRepository, 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
}

func GetRepositoryFactory

func GetRepositoryFactory() (*RepositoryFactory, error)

func NewRepositoryFactory

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

Jump to

Keyboard shortcuts

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