Versions in this module Expand all Collapse all v1 v1.1.1 Oct 30, 2021 v1.1.0 Oct 25, 2021 Changes in this version type AppStore + func NewAppStoreWithCrypto(db *sqlx.DB, crypto *crypto.AESGCM, mm ...database.Model) *AppStore type Resource + const Webhook v1.0.0 Apr 20, 2021 Changes in this version + var ErrAuth = errors.New("authentication failed") + var Permissions = []Permission + var Resources = []Resource + func AppModel(aa []*App) func(int) database.Model + func CodeModel(cc []*Code) func(int) database.Model + func SelectToken(col string, opts ...query.Option) query.Query + func TokenModel(tt []*Token) func(int) database.Model + type App struct + ClientID string + ClientSecret []byte + CreatedAt time.Time + Description string + HomeURI string + ID int64 + Name string + RedirectURI string + User *user.User + UserID int64 + func (*App) JSON(_ string) map[string]interface{} + func (a *App) Bind(mm ...database.Model) + func (a *App) Endpoint(uri ...string) string + func (a *App) IsZero() bool + func (a *App) Primary() (string, int64) + func (a *App) SetPrimary(id int64) + func (a *App) Values() map[string]interface{} + type AppForm struct + App *App + Apps *AppStore + Description string + HomepageURI string + Name string + RedirectURI string + func (f AppForm) Fields() map[string]string + func (f AppForm) Validate() error + type AppStore struct + User *user.User + func NewAppStore(db *sqlx.DB, mm ...database.Model) *AppStore + func NewAppStoreWithBlock(db *sqlx.DB, block *crypto.Block, mm ...database.Model) *AppStore + func (s *AppStore) All(opts ...query.Option) ([]*App, error) + func (s *AppStore) Auth(id, secret string) (*App, error) + func (s *AppStore) Bind(mm ...database.Model) + func (s *AppStore) Create(name, description, homepage, redirect string) (*App, error) + func (s *AppStore) Delete(ids ...int64) error + func (s *AppStore) Get(opts ...query.Option) (*App, error) + func (s *AppStore) New() *App + func (s *AppStore) Reset(id int64) error + func (s *AppStore) Update(id int64, name, description, homepage, redirect string) error + type AuthorizeForm struct + Authorize bool + ClientID string + Handle string + Password string + RedirectURI string + Scope string + State string + func (f AuthorizeForm) Fields() map[string]string + func (f AuthorizeForm) Validate() error + type Code struct + App *App + AppID int64 + Code string + ExpiresAt time.Time + ID int64 + Scope Scope + User *user.User + UserID int64 + func (*Code) Endpoint(_ ...string) string + func (*Code) JSON(_ string) map[string]interface{} + func (c *Code) Bind(mm ...database.Model) + func (c *Code) IsZero() bool + func (c *Code) Primary() (string, int64) + func (c *Code) SetPrimary(id int64) + func (c *Code) Values() map[string]interface{} + type CodeStore struct + App *App + User *user.User + func NewCodeStore(db *sqlx.DB, mm ...database.Model) *CodeStore + func (s *CodeStore) Bind(mm ...database.Model) + func (s *CodeStore) Create(scope Scope) (*Code, error) + func (s *CodeStore) Delete(ids ...int64) error + func (s *CodeStore) Get(opts ...query.Option) (*Code, error) + func (s *CodeStore) New() *Code + type Permission int + const Delete + const Read + const Write + func (i Permission) String() string + func (p Permission) Expand() []Permission + func (p Permission) Has(mask Permission) bool + type Resource int + const Build + const Cron + const Image + const Invite + const Key + const Namespace + const Object + const Variable + func (i Resource) String() string + type Scope []scopeItem + func NewScope() Scope + func ScopeDiff(a, b Scope) Scope + func UnmarshalScope(s string) (Scope, error) + func (sc *Scope) Add(res Resource, perm Permission) + func (sc *Scope) Scan(val interface{}) error + func (sc *Scope) Spread() []string + func (sc *Scope) String() string + func (sc *Scope) UnmarshalText(b []byte) error + func (sc Scope) Value() (driver.Value, error) + type Token struct + App *App + AppID sql.NullInt64 + CreatedAt time.Time + ID int64 + Name string + Scope Scope + Token string + UpdatedAt time.Time + User *user.User + UserID int64 + func TokenFromContext(ctx context.Context) (*Token, bool) + func (*Token) JSON(_ string) map[string]interface{} + func (t *Token) Bind(mm ...database.Model) + func (t *Token) Endpoint(uri ...string) string + func (t *Token) IsZero() bool + func (t *Token) Permissions() map[string]struct{} + func (t *Token) Primary() (string, int64) + func (t *Token) SetPrimary(id int64) + func (t *Token) Values() map[string]interface{} + type TokenForm struct + Name string + Scope []string + Token *Token + Tokens *TokenStore + func (f TokenForm) Fields() map[string]string + func (f TokenForm) Validate() error + type TokenStore struct + App *App + User *user.User + func NewTokenStore(db *sqlx.DB, mm ...database.Model) *TokenStore + func (s *TokenStore) All(opts ...query.Option) ([]*Token, error) + func (s *TokenStore) Bind(mm ...database.Model) + func (s *TokenStore) Create(name string, sc Scope) (*Token, error) + func (s *TokenStore) Delete(ids ...int64) error + func (s *TokenStore) Get(opts ...query.Option) (*Token, error) + func (s *TokenStore) New() *Token + func (s *TokenStore) Reset(id int64) error + func (s *TokenStore) Revoke(appId int64) error + func (s *TokenStore) Update(id int64, name string, sc Scope) error