repository

package
v0.0.0-...-2ff099c Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewDB

func NewDB() *sql.DB

DBインスタンスを取得する シングルトンパターンで行うためのやり方

Types

type Beginner

type Beginner interface {
	BeginTx(ctx context.Context, opts *sql.TxOptions) (*sql.Tx, error)
}

トランザクションを開始するためのインターフェース

type CreateUsersParams

type CreateUsersParams struct {
	FamilyName     string    `db:"family_name"`
	FamilyNameKana string    `db:"family_name_kana"`
	FirstName      string    `db:"first_name"`
	FirstNameKana  string    `db:"first_name_kana"`
	Email          string    `db:"email"`
	Password       string    `db:"password"`
	SendingPoint   int32     `db:"sending_point"`
	CreatedAt      time.Time `db:"created_at"`
	UpdateAt       time.Time `db:"update_at"`
}

type DBTX

type DBTX interface {
	ExecContext(context.Context, string, ...interface{}) (sql.Result, error)
	PrepareContext(context.Context, string) (*sql.Stmt, error)
	QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error)
	QueryRowContext(context.Context, string, ...interface{}) *sql.Row
}

type GetByUserIDRow

type GetByUserIDRow struct {
	ID    int64  `db:"id"`
	Email string `db:"email"`
}

type Querier

type Querier interface {
	CreateUsers(ctx context.Context, db DBTX, arg CreateUsersParams) (sql.Result, error)
	GetByUserID(ctx context.Context, db DBTX, id int64) (GetByUserIDRow, error)
	GetPointByUserID(ctx context.Context, db DBTX, receivingUserID uint64) (Transactions, error)
	UpdateUser(ctx context.Context, db DBTX, arg UpdateUserParams) error
	UpdateUserMail(ctx context.Context, db DBTX, arg UpdateUserMailParams) error
}

type Queries

type Queries struct {
}

func New

func New() *Queries

func (*Queries) CreateUsers

func (q *Queries) CreateUsers(ctx context.Context, db DBTX, arg CreateUsersParams) (sql.Result, error)

func (*Queries) GetByUserID

func (q *Queries) GetByUserID(ctx context.Context, db DBTX, id int64) (GetByUserIDRow, error)

func (*Queries) GetPointByUserID

func (q *Queries) GetPointByUserID(ctx context.Context, db DBTX, receivingUserID uint64) (Transactions, error)

func (*Queries) UpdateUser

func (q *Queries) UpdateUser(ctx context.Context, db DBTX, arg UpdateUserParams) error

func (*Queries) UpdateUserMail

func (q *Queries) UpdateUserMail(ctx context.Context, db DBTX, arg UpdateUserMailParams) error

type Transactions

type Transactions struct {
	// 取引の識別子
	ID uint64 `db:"id"`
	// 送信ユーザのID
	SendingUserID uint64 `db:"sending_user_id"`
	// 受信ユーザのID
	ReceivingUserID uint64 `db:"receiving_user_id"`
	// 取引ポイント
	TransactionPoint int32 `db:"transaction_point"`
	// 取引日時
	TransactionAt time.Time `db:"transaction_at"`
}

取引

type UpdateUserMailParams

type UpdateUserMailParams struct {
	Email string `db:"email"`
	ID    int64  `db:"id"`
}

type UpdateUserParams

type UpdateUserParams struct {
	FirstName      string `db:"first_name"`
	FamilyName     string `db:"family_name"`
	FirstNameKana  string `db:"first_name_kana"`
	FamilyNameKana string `db:"family_name_kana"`
	Email          string `db:"email"`
	ID             int64  `db:"id"`
}

type Users

type Users struct {
	// ユーザーの識別子
	ID int64 `db:"id"`
	// 苗字
	FamilyName string `db:"family_name"`
	// 苗字カナ
	FamilyNameKana string `db:"family_name_kana"`
	// 名前
	FirstName string `db:"first_name"`
	// 名前カナ
	FirstNameKana string `db:"first_name_kana"`
	// メールアドレス
	Email string `db:"email"`
	// パスワードハッシュ
	Password string `db:"password"`
	// 送信可能ポイント
	SendingPoint int32 `db:"sending_point"`
	// レコード作成日時
	CreatedAt time.Time `db:"created_at"`
	// レコード修正日時
	UpdateAt time.Time `db:"update_at"`
}

ユーザー

Directories

Path Synopsis
Package mock_repository is a generated GoMock package.
Package mock_repository is a generated GoMock package.

Jump to

Keyboard shortcuts

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