Documentation ¶
Index ¶
- Constants
- func Database(use *sqlx.DB)
- func Setup()
- type Account
- func (a Account) GetSubscription() *Subscription
- func (a Account) GetToken(t string, tokenType int) (*Token, error)
- func (a Account) GetTokenList(tokenType int) []*Token
- func (a Account) HasSubscription() bool
- func (a Account) IsStored() bool
- func (a Account) Refresh() (*Account, error)
- func (a Account) Remove() error
- func (a Account) Store() (*Account, error)
- func (a Account) Verify() (*Account, error)
- type AccountInterface
- type Note
- type NoteInterface
- type Subscription
- type SubscriptionInterface
- type Token
- type TokenInterface
Constants ¶
const ( // TokenTypeMaintenace defines maintenance tokens TokenTypeMaintenace = 1 // TokenTypeAccess defines access tokens TokenTypeAccess = 2 )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Account ¶
type Account struct { ID int `db:"id"` Address string `db:"address"` Created time.Time `db:"created"` Verified bool `db:"verified"` }
Account implements AccountInterface
func AccountByAddress ¶
AccountByAddress retrieves Account by address
func (Account) GetSubscription ¶
func (a Account) GetSubscription() *Subscription
GetSubscription retrieves Account Subscription
func (Account) GetTokenList ¶
GetTokenList retrieves all Token for Account
func (Account) HasSubscription ¶
HasSubscription checks if Account has a Subscription
type AccountInterface ¶
type AccountInterface interface { GetSubscription() *Subscription GetToken(t string, tokenType int) (*Token, error) GetTokenList(tokenType int) []*Token HasSubscription() bool IsStored() bool Refresh() (*Account, error) Remove() error Store() (*Account, error) Verify() (*Account, error) // contains filtered or unexported methods }
AccountInterface defines Account
type Note ¶
type Note struct { ID int `db:"id"` Account int `db:"account"` Text string `db:"text"` Created time.Time `db:"created"` }
Note implements NoteInterface
func NoteListByAccount ¶
NoteListByAccount retrieves Note by id
type NoteInterface ¶
type NoteInterface interface { IsStored() bool Store() (*Note, error) // contains filtered or unexported methods }
NoteInterface defines Note
type Subscription ¶
type Subscription struct { ID int `db:"id"` Account int `db:"account"` Created time.Time `db:"created"` StripeID string `db:"stripeid"` Active bool `db:"active"` }
Subscription implements SubscriptionInterface
func SubscriptionByAccountID ¶
func SubscriptionByAccountID(id int) (*Subscription, error)
SubscriptionByAccountID retrieves Subscription by Account id
func SubscriptionByID ¶
func SubscriptionByID(id int) (*Subscription, error)
SubscriptionByID retrieves Subscription by id
func SubscriptionNew ¶
func SubscriptionNew(account int, stripeid string) *Subscription
SubscriptionNew creates a new Subscription
func (Subscription) Activate ¶
func (s Subscription) Activate() (*Subscription, error)
Activate activates Subscripiton and updates the DB
func (Subscription) Deactivate ¶
func (s Subscription) Deactivate() (*Subscription, error)
Deactivate deactivates Subscrition and updates the DB
func (Subscription) IsStored ¶
func (s Subscription) IsStored() bool
IsStored checks if Subscription is stored in DB
func (Subscription) Refresh ¶
func (s Subscription) Refresh() (*Subscription, error)
Refresh Subscription from DB
func (Subscription) Store ¶
func (s Subscription) Store() (*Subscription, error)
Store writes Subscription to DB
type SubscriptionInterface ¶
type SubscriptionInterface interface { Activate() (*Subscription, error) Deactivate() (*Subscription, error) IsStored() bool Refresh() (*Subscription, error) Store() (*Subscription, error) // contains filtered or unexported methods }
SubscriptionInterface defines Subscription
type Token ¶
type Token struct { ID int `db:"id"` Account int `db:"account"` Text string `db:"text"` Created time.Time `db:"created"` Type int `db:"type"` Active bool `db:"active"` // contains filtered or unexported fields }
Token implements TokenInterface
func TokenListByAccountAndType ¶
TokenListByAccountAndType retrieves Token list by Account and type
func (Token) Deactivate ¶
Deactivate activates Token and updates the DB