Documentation ¶
Index ¶
- Constants
- Variables
- type DB
- type DynamoDB
- func (db *DynamoDB) DeleteKifu(ctx context.Context, kifuId string, version int64) error
- func (db *DynamoDB) GetKifu(ctx context.Context, kifuId string) (*documentpb.Kifu, int64, error)
- func (db *DynamoDB) GetKifuAndSteps(ctx context.Context, kifuId string) (*documentpb.Kifu, []*documentpb.Step, int64, error)
- func (db *DynamoDB) GetKifuIdsBySfen(ctx context.Context, sfen string) ([]*UserKifu, error)
- func (db *DynamoDB) GetRecentKifu(ctx context.Context, userId string, limit int) ([]*documentpb.Kifu, error)
- func (db *DynamoDB) GetSamePositions(ctx context.Context, userIds []string, pos string, ...) ([]*Position, error)
- func (db *DynamoDB) ListKifu(ctx context.Context, userId string, ...) error
- func (db *DynamoDB) PutKifu(ctx context.Context, kifu *documentpb.Kifu, steps []*documentpb.Step, ...) (int64, error)
- type DynamoDBKifuRecord
- type DynamoDBOption
- type ErrInvalidValue
- type GetSamePositionsOption
- type GetStepsOption
- type Position
- type StepSlice
- type UserKifu
Constants ¶
View Source
const (
BatchUnit = 25
)
Variables ¶
View Source
var ( ErrUserIdIsEmpty = errors.New("user_id is empty") ErrKifuIdIsEmpty = errors.New("kifu_id is empty") ErrPositionIsEmpty = errors.New("position is empty") ErrLockError = errors.New("optimistic locking error") )
View Source
var (
ErrEmpty = errors.New("result is empty")
)
Functions ¶
This section is empty.
Types ¶
type DB ¶
type DB interface { PutKifu(ctx context.Context, kifu *documentpb.Kifu, steps []*documentpb.Step, version int64) (int64, error) GetKifu(ctx context.Context, kifuId string) (*documentpb.Kifu, int64, error) GetKifuAndSteps(ctx context.Context, kifuId string) (*documentpb.Kifu, []*documentpb.Step, int64, error) ListKifu(ctx context.Context, userId string, f func(*documentpb.Kifu, int64)) error GetKifuIdsBySfen(ctx context.Context, sfen string) ([]*UserKifu, error) GetSamePositions(ctx context.Context, userIds []string, pos string, options ...GetSamePositionsOption) ([]*Position, error) GetRecentKifu(ctx context.Context, userId string, limit int) ([]*documentpb.Kifu, error) DeleteKifu(ctx context.Context, kifuId string, version int64) error }
type DynamoDB ¶
type DynamoDB struct {
// contains filtered or unexported fields
}
func NewDynamoDB ¶
func NewDynamoDB(client *dynamodb.DynamoDB, tableName string, ops ...DynamoDBOption) *DynamoDB
func (*DynamoDB) DeleteKifu ¶
func (*DynamoDB) GetKifuAndSteps ¶
func (db *DynamoDB) GetKifuAndSteps( ctx context.Context, kifuId string, ) (*documentpb.Kifu, []*documentpb.Step, int64, error)
func (*DynamoDB) GetKifuIdsBySfen ¶
func (*DynamoDB) GetRecentKifu ¶
func (*DynamoDB) GetSamePositions ¶
type DynamoDBKifuRecord ¶
type DynamoDBKifuRecord struct { UserId string `dynamodbav:"userId,omitempty"` KifuId string `dynamodbav:"kifuId"` Var string `dynamodbav:"var"` CreatedTs int64 `dynamodbav:"createdTs,omitempty"` StartTs int64 `dynamodbav:"startTs,omitempty"` Sfen string `dynamodbav:"sfen,omitempty"` Seq int32 `dynamodbav:"seq,omitempty"` Pos string `dynamodbav:"pos,omitempty"` Kifu []byte `dynamodbav:"kifu,omitempty"` Step []byte `dynamodbav:"step,omitempty"` Version int64 `dynamodbav:"version,omitempty"` StepNum int32 `dynamodbav:"stepNum,omitempty"` }
type DynamoDBOption ¶
type DynamoDBOption func(*DynamoDB)
func SetParallelism ¶
func SetParallelism(i int) DynamoDBOption
type ErrInvalidValue ¶
type ErrInvalidValue struct {
Details string
}
func (*ErrInvalidValue) Error ¶
func (*ErrInvalidValue) Error() string
type GetSamePositionsOption ¶
type GetSamePositionsOption func(*getSamePositionsOptions)
func GetSamePositionsAddExcludeKifuId ¶
func GetSamePositionsAddExcludeKifuId(kifuId string) GetSamePositionsOption
func GetSamePositionsAddExcludeKifuIds ¶
func GetSamePositionsAddExcludeKifuIds(kifuIds []string) GetSamePositionsOption
func GetSamePositionsSetNumStep ¶
func GetSamePositionsSetNumStep(n int32) GetSamePositionsOption
type GetStepsOption ¶
type GetStepsOption func(*getStepsOptions)
func GetStepsSetRange ¶
func GetStepsSetRange(start, end int32) GetStepsOption
type StepSlice ¶
type StepSlice []*documentpb.Step
Click to show internal directories.
Click to hide internal directories.