Documentation ¶
Index ¶
- type Db
- type Element
- func (this *Element) Account() string
- func (this *Element) AddToken(tok string)
- func (this *Element) Attributes() map[string]bool
- func (this *Element) Date() time.Time
- func (this *Element) Expires() time.Time
- func (this *Element) Id() string
- func (this *Element) Invalid() bool
- func (this *Element) Invalidate()
- func (this *Element) MarshalJSON() (data []byte, err error)
- func (this *Element) Scope() map[string]bool
- func (this *Element) Ta() string
- func (this *Element) Tokens() map[string]bool
- func (this *Element) UnmarshalJSON(data []byte) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Db ¶
type Db interface { // 取得。 Get(id string) (*Element, error) // 保存。 // exp: 保存期限。この期間以降は Get や Replace できなくて良い。 Save(elem *Element, exp time.Time) error // 上書き。 // savedDate が保存されている要素の更新日時と同じでなければ失敗する。 Replace(elem *Element, savedDate time.Time) (ok bool, err error) }
アクセストークン情報の格納庫。
func NewMemoryDb ¶
func NewMemoryDb() Db
type Element ¶
type Element struct {
// contains filtered or unexported fields
}
アクセストークン情報。
func (*Element) MarshalJSON ¶
{ "id": <ID>, "invalid": <無効か>, "expires": <有効期限>, "account": <アカウント ID>, "scope": [ <許可スコープ>, ... ], "attributes": [ <許可属性>, ... ], "client_id": <TA の ID>, "tokens": [ <アクセストークン>, ... ], "date": <更新日時> }
func (*Element) UnmarshalJSON ¶
Click to show internal directories.
Click to hide internal directories.