Documentation ¶
Index ¶
- func CreateDepositID(ctx context.Context) string
- func CreateUserID(ctx context.Context, id int64) string
- func RandomOpen() map[string]bool
- func RandomTags() []string
- func RandomUserID(ctx context.Context) string
- func SetUserAccountIDMax(v int64)
- func UserAccountIDMax() int64
- type DepositAlloyRunner
- type DepositDMLRunner
- type DepositRunner
- type DepositType
- type FindUserDepositHistoriesAlloyRunner
- type FindUserDepositHistoriesRunner
- type ReadUserBalancesAlloyRunner
- type Store
- func (s *Store) CreateUserAccount(ctx context.Context, userAccount *UserAccount) (resultUserAccount *UserAccount, err error)
- func (s *Store) Deposit(ctx context.Context, userID string, depositID string, depositType DepositType, ...) (userBalance *UserBalance, userDepositHistories *UserDepositHistory, err error)
- func (s *Store) DepositDML(ctx context.Context, userID string, depositID string, depositType DepositType, ...) (userBalance *UserBalance, userDepositHistories *UserDepositHistory, err error)
- func (s *Store) FindUserDepositHistories(ctx context.Context, userID string) (models []*UserDepositHistory, err error)
- func (s *Store) InsertOrUpdateUserDepositHistorySum(ctx context.Context, tx *spanner.ReadWriteTransaction, ...) (err error)
- func (s *Store) SelectUserDepositHistory(ctx context.Context, userID string, limit int) (list []*UserDepositHistory, err error)
- func (s *Store) UserAccountTable() string
- func (s *Store) UserBalanceTable() string
- func (s *Store) UserDepositHistoryTable() string
- type StoreAlloy
- func (s *StoreAlloy) Deposit(ctx context.Context, userID string, depositID string, depositType DepositType, ...) (err error)
- func (s *StoreAlloy) FindUserDepositHistories(ctx context.Context, userID string, primary bool) (models []*UserDepositHistory, err error)
- func (s *StoreAlloy) InsertUserBalance(ctx context.Context, model *UserBalance) (err error)
- func (s *StoreAlloy) ReadUserBalances(ctx context.Context, userIDs []string, primary bool) (models []*UserBalance, err error)
- func (s *StoreAlloy) UserBalanceTable() string
- func (s *StoreAlloy) UserDepositHistoryTable() string
- type SupplementaryInformation
- type UserAccount
- type UserBalance
- type UserDepositHistory
- type UserDepositHistorySum
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateDepositID ¶
func RandomOpen ¶
func RandomTags ¶
func RandomTags() []string
func RandomUserID ¶
func SetUserAccountIDMax ¶
func SetUserAccountIDMax(v int64)
SetUserAccountIDMax is default値から変更する場合、アプリケーション起動時に一度だけ呼ぶ
func UserAccountIDMax ¶
func UserAccountIDMax() int64
Types ¶
type DepositAlloyRunner ¶
type DepositAlloyRunner struct { Store *StoreAlloy OperationStore *operation.StoreAlloy }
type DepositDMLRunner ¶
type DepositRunner ¶
type DepositType ¶
type DepositType int
const ( // DepositTypeBank is 銀行 DepositTypeBank DepositType = iota // DepositTypeCampaignPoint is キャンペーンポイント DepositTypeCampaignPoint // DepositTypeRefund is 返金 DepositTypeRefund // DepositTypeSales is 売上 DepositTypeSales )
func RandomDepositType ¶
func RandomDepositType(ctx context.Context) DepositType
func (DepositType) ToIntn ¶
func (t DepositType) ToIntn() int64
type FindUserDepositHistoriesAlloyRunner ¶
type FindUserDepositHistoriesAlloyRunner struct {
Store *StoreAlloy
}
type FindUserDepositHistoriesRunner ¶
type FindUserDepositHistoriesRunner struct {
BalanceStore *Store
}
type ReadUserBalancesAlloyRunner ¶
type ReadUserBalancesAlloyRunner struct {
Store *StoreAlloy
}
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
func (*Store) CreateUserAccount ¶
func (s *Store) CreateUserAccount(ctx context.Context, userAccount *UserAccount) (resultUserAccount *UserAccount, err error)
func (*Store) Deposit ¶
func (s *Store) Deposit(ctx context.Context, userID string, depositID string, depositType DepositType, amount int64, point int64) (userBalance *UserBalance, userDepositHistories *UserDepositHistory, err error)
func (*Store) DepositDML ¶
func (s *Store) DepositDML(ctx context.Context, userID string, depositID string, depositType DepositType, amount int64, point int64) (userBalance *UserBalance, userDepositHistories *UserDepositHistory, err error)
func (*Store) FindUserDepositHistories ¶
func (s *Store) FindUserDepositHistories(ctx context.Context, userID string) (models []*UserDepositHistory, err error)
FindUserDepositHistories is 指定したuserIDのUserDepositHistoryの最新100件を取得する SQLで最初から取得すれば良いが、GetMultiをやるめたにワンクッション置いている
func (*Store) InsertOrUpdateUserDepositHistorySum ¶
func (s *Store) InsertOrUpdateUserDepositHistorySum(ctx context.Context, tx *spanner.ReadWriteTransaction, value *UserDepositHistorySum) (err error)
InsertOrUpdateUserDepositHistorySum is UserDepositHistorySum TableにInsertOrUpdateする
func (*Store) SelectUserDepositHistory ¶
func (*Store) UserAccountTable ¶
func (*Store) UserBalanceTable ¶
func (*Store) UserDepositHistoryTable ¶
type StoreAlloy ¶
type StoreAlloy struct {
// contains filtered or unexported fields
}
func NewStoreAlloy ¶
func NewStoreAlloy(pool *pgxpool.Pool, readReplicaPool []*pgxpool.Pool) *StoreAlloy
func (*StoreAlloy) Deposit ¶
func (s *StoreAlloy) Deposit(ctx context.Context, userID string, depositID string, depositType DepositType, amount int64, point int64) (err error)
func (*StoreAlloy) FindUserDepositHistories ¶
func (s *StoreAlloy) FindUserDepositHistories(ctx context.Context, userID string, primary bool) (models []*UserDepositHistory, err error)
FindUserDepositHistories is 指定したuserIDのUserDepositHistoryを100件取得する SQLだと本来普通にSELECTすれば良いだけだが、GetMultiをするためにPKだけ取得した後、INで再度取得している
func (*StoreAlloy) InsertUserBalance ¶
func (s *StoreAlloy) InsertUserBalance(ctx context.Context, model *UserBalance) (err error)
func (*StoreAlloy) ReadUserBalances ¶
func (s *StoreAlloy) ReadUserBalances(ctx context.Context, userIDs []string, primary bool) (models []*UserBalance, err error)
ReadUserBalances is 指定した複数のUserIDのBalanceを取得する defaultではReadReplicaから取得される。primary=trueにするとprimary instanceから取得される
func (*StoreAlloy) UserBalanceTable ¶
func (s *StoreAlloy) UserBalanceTable() string
func (*StoreAlloy) UserDepositHistoryTable ¶
func (s *StoreAlloy) UserDepositHistoryTable() string
type UserAccount ¶
type UserBalance ¶
type UserDepositHistory ¶
type UserDepositHistory struct { UserID string DepositID string DepositType DepositType `spanner:"-"` Amount int64 Point int64 SumVersion string SupplementaryInformation *SupplementaryInformation `spanner:"-"` CreatedAt time.Time }
func (*UserDepositHistory) FromRow ¶
func (v *UserDepositHistory) FromRow(row *spanner.Row) (*UserDepositHistory, error)
func (*UserDepositHistory) ToMutationMap ¶
func (v *UserDepositHistory) ToMutationMap() map[string]interface{}
Click to show internal directories.
Click to hide internal directories.