Documentation
¶
Index ¶
Constants ¶
View Source
const ( // DeletedUserEmail は、削除されたユーザのメールアドレスを表します。 // メールアドレスの UNIQUE 制約は論理削除されていないレコードのみを対象としているため、削除済みユーザのメールアドレスが重複しても問題ない。 DeletedUserEmail = "" )
Variables ¶
View Source
var ( ErrKVSEntryValueTooLarge = errors.New("value size is too large") ErrPrivateKVSETagMismatch = errors.New("private KVS etag mismatch") )
View Source
var (
ErrUserDeactivated = errors.New("user is deactivated")
)
View Source
var (
ErrUserProfileTooLarge = errors.New("user profile is too large")
)
Functions ¶
This section is empty.
Types ¶
type GlobalKVSBucket ¶
type GlobalKVSBucket struct {
KVSBucket
}
GlobalKVSBucket は、全ユーザで共有される KVS を表します。 専用 API が提供されていないプロダクト固有の機能は、この機能で代用される想定です。
func NewGlobalKVSBucket ¶
func NewGlobalKVSBucket(entries []KVSEntry) GlobalKVSBucket
type KVSBucket ¶
type KVSBucket struct {
// contains filtered or unexported fields
}
KVSBucket は、KVS におけるエントリの配列操作を提供します。
func NewKVSBucket ¶
type KVSCriteria ¶
func NewKVSCriteria ¶
func NewKVSCriteria(exactMatch, prefixMatch []string) KVSCriteria
func (KVSCriteria) IsEmpty ¶
func (c KVSCriteria) IsEmpty() bool
type LeaderBoard ¶ added in v0.2.0
type LeaderBoard struct {
ID string
Scores []LeaderBoardScore
}
func NewLeaderBoard ¶ added in v0.2.0
func NewLeaderBoard(id string, scored []LeaderBoardScore) LeaderBoard
func (*LeaderBoard) SubmitScore ¶ added in v0.2.0
func (l *LeaderBoard) SubmitScore(score LeaderBoardScore)
SubmitScore は、リーダーボードにスコアを提出します。 スコアの保持者はユーザとは限らない ので、誰でもスコアを上書きできるようになっています。 例えばブログのいいね数ランキングをリーダーボード機能で実現する場合、いいね送信者がスコアを提出することになります。
type LeaderBoardScore ¶ added in v0.2.0
type LeaderBoardScore struct {
// ScoreID は、スコア集計対象である任意のオブジェクトIDが指定されます。
// 例: ユーザID、ブログID
ScoreID string
Score int
Timestamp time.Time
}
LeaderBoardScore は、リーダーボードに登録されるスコアを表します。
func NewLeaderBoardScore ¶ added in v0.2.0
func NewLeaderBoardScore(scoreID string, score int, timestamp time.Time) LeaderBoardScore
type PrivateKVSBucket ¶
type PrivateKVSBucket struct {
KVSBucket
UserID uuid.UUID
// contains filtered or unexported fields
}
PrivateKVSBucket はユーザごとに独立した KVS で、他ユーザには公開されません。
func NewPrivateKVSBucket ¶
func (PrivateKVSBucket) ETag ¶
func (m PrivateKVSBucket) ETag() uuid.UUID
type User ¶
type User struct {
ID uuid.UUID
Email string
Status UserStatus
}
func (User) IsUnavailable ¶ added in v0.2.0
type UserAuthentication ¶
type UserAuthentication struct {
UserID uuid.UUID
// BaaS ごとにユーザIDの表現が異なるため、文字列型にしている。
BaasUserID string
LastAuthenticatedAt time.Time
}
UserAuthentication はユーザの認証に必要な情報を提供します。 認証/再認証のみで利用され、セッション管理のコンテキストでは利用されません。
func NewUserAuthentication ¶
func (*UserAuthentication) Refresh ¶
func (a *UserAuthentication) Refresh(now time.Time)
type UserProfile ¶
プロフィールのデータ構造はプロダクトによって異なり、汎化が難しい。 そのため、プロフィールをバイナリデータとして扱い、プロダクトごとに独自スキーマを定義させる。
func NewUserProfile ¶
func NewUserProfile(userID uuid.UUID, v []byte) (UserProfile, error)
func (UserProfile) Bytes ¶
func (p UserProfile) Bytes() []byte
type UserStatus ¶
type UserStatus int
const ( // 設定が未完了で、他ユーザには公開されていない状態。 // サインイン後、設定を完了するまでこの状態が続く。 UserStatusPending UserStatus = 1 + iota // アカウントが利用可能で、他ユーザにも公開されている状態。 UserStatusActive // アカウントが削除され、利用不可な状態。 // この状態になると、二度と利用できなくなる。 UserStatusDeactivated )
Click to show internal directories.
Click to hide internal directories.