Documentation
¶
Index ¶
- Variables
- func Init(db DBConnection, kv KVConnection, jwtSigningSecret string)
- func Run(port int)
- func Shutdown()
- type Account
- type AccountManager
- func (am *AccountManager) ChangePassword(accountID uint, newPassword string) error
- func (am *AccountManager) Close() error
- func (am *AccountManager) CreateAccount(email string, password string) (*Account, error)
- func (am *AccountManager) GenerateJWT(accountID uint) (string, error)
- func (am *AccountManager) GetAccountByEmail(email string) (*Account, error)
- func (am *AccountManager) Login(email string, password string) (string, string, error)
- func (am *AccountManager) Logout(login Login) error
- func (am *AccountManager) RecordLogin(login Login) error
- func (am *AccountManager) ValidateJWT(jwtToken string) (uint, error)
- func (am *AccountManager) ValidateRefreshToken(refreshToken string) (Login, error)
- type AccountRequest
- type DB
- type DBConnection
- type KVConnection
- type KVStore
- type Link
- type LinkManager
- type LinkRequest
- type Login
- type Query
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrExpiredJWT = fmt.Errorf("JWT has expired")
View Source
var ErrShortUrlExists = fmt.Errorf("shortUrl already exists")
Functions ¶
func Init ¶
func Init(db DBConnection, kv KVConnection, jwtSigningSecret string)
Types ¶
type AccountManager ¶
type AccountManager struct {
// contains filtered or unexported fields
}
func NewAccountManager ¶
func NewAccountManager(db *DB, kv *KVStore, jwtSigningSecret string) *AccountManager
func (*AccountManager) ChangePassword ¶
func (am *AccountManager) ChangePassword(accountID uint, newPassword string) error
func (*AccountManager) Close ¶
func (am *AccountManager) Close() error
func (*AccountManager) CreateAccount ¶
func (am *AccountManager) CreateAccount(email string, password string) (*Account, error)
func (*AccountManager) GenerateJWT ¶
func (am *AccountManager) GenerateJWT(accountID uint) (string, error)
func (*AccountManager) GetAccountByEmail ¶
func (am *AccountManager) GetAccountByEmail(email string) (*Account, error)
func (*AccountManager) Logout ¶
func (am *AccountManager) Logout(login Login) error
func (*AccountManager) RecordLogin ¶
func (am *AccountManager) RecordLogin(login Login) error
func (*AccountManager) ValidateJWT ¶
func (am *AccountManager) ValidateJWT(jwtToken string) (uint, error)
func (*AccountManager) ValidateRefreshToken ¶
func (am *AccountManager) ValidateRefreshToken(refreshToken string) (Login, error)
type AccountRequest ¶
type DB ¶
func NewDatabase ¶
func NewDatabase(dbConn DBConnection) (*DB, error)
type DBConnection ¶
type DBConnection struct {
Address string
}
type KVConnection ¶
type KVConnection struct {
Address string
}
type KVStore ¶
type KVStore struct {
// contains filtered or unexported fields
}
func NewKVStore ¶
func NewKVStore(kvConn KVConnection) (*KVStore, error)
type LinkManager ¶
type LinkManager struct {
// contains filtered or unexported fields
}
func NewLinkManager ¶
func NewLinkManager(db *DB, kv *KVStore) *LinkManager
func (*LinkManager) CreateLink ¶
func (lm *LinkManager) CreateLink(url string, shortUrl string, accountID uint) error
type LinkRequest ¶
Source Files
¶
Click to show internal directories.
Click to hide internal directories.