Documentation ¶
Index ¶
- Variables
- type AssetStore
- type BoltDataStore
- func (ds BoltDataStore) Close()
- func (ds BoltDataStore) CreateBuckets()
- func (db BoltDataStore) GetUserByToken(token string) (user User, err error)
- func (ds BoltDataStore) GetUserByUsernameAndPassword(username string, password string) (user User, err error)
- func (db BoltDataStore) NewTokenForUser(user User) (token string, err error)
- type ContentTemplate
- type ContentType
- type DataStore
- type Field
- type FieldType
- type FieldValue
- type Resource
- type Scanner
- type SpruceApp
- type SqlDataStore
- type Token
- type User
- type UserToken
Constants ¶
This section is empty.
Variables ¶
var ErrIncorrectPassword = errors.New("Incorrect password")
var ErrInvalidToken = errors.New("Invalid token")
var ErrUnknownUser = errors.New("Unknown user")
Functions ¶
This section is empty.
Types ¶
type AssetStore ¶
type AssetStore interface { }
type BoltDataStore ¶
func NewBoltDataStore ¶
func NewBoltDataStore() (db BoltDataStore, err error)
NewBoltDataStore opens a new connection to a BoltDB database.
func (BoltDataStore) Close ¶
func (ds BoltDataStore) Close()
Closes the underlying BoltDB database. Ensure this is called before the application exits.
func (BoltDataStore) CreateBuckets ¶
func (ds BoltDataStore) CreateBuckets()
CreateBuckets ensures all the BoltDB buckets used by the application are created. This function is called automatically by NewBoltDataStore(). If some other means is used to get a BoltDataStore, this function may need to be called manually to ensure the buckets exist.
func (BoltDataStore) GetUserByToken ¶
func (db BoltDataStore) GetUserByToken(token string) (user User, err error)
func (BoltDataStore) GetUserByUsernameAndPassword ¶
func (ds BoltDataStore) GetUserByUsernameAndPassword(username string, password string) (user User, err error)
func (BoltDataStore) NewTokenForUser ¶
func (db BoltDataStore) NewTokenForUser(user User) (token string, err error)
type ContentTemplate ¶
type ContentType ¶
type Field ¶
type Field struct { ID string // TODO Should this be a GUID? Name string TypeID string Type FieldType Position int // Used to sort fields in the UI MinValues int // The minimum number of FieldValues required to be assigned in the UI MaxValues int // The maximum number of FieldValues allowed to be assigned in the UI }
A Field is a concrete instance of a FieldType attached to a ContentType in a particular position.
For example, the "Department" Field on a "Staff" ContentType which should be the 3rd field in the UI.
NOTE: This type does not store data values. In the example above, the value "Marketing" is attached to a Resource as a FieldValue
type FieldValue ¶
type FieldValue struct { Field Field Value interface{} }
func (*FieldValue) IsValid ¶
func (fv *FieldValue) IsValid() bool
type SpruceApp ¶
type SpruceApp struct { Logger *logrus.Logger DataStore DataStore AssetStore AssetStore // contains filtered or unexported fields }
func NewSpruceApp ¶
func NewSpruceApp() *SpruceApp
type SqlDataStore ¶
func (SqlDataStore) GetUserByToken ¶
func (db SqlDataStore) GetUserByToken(token string) (user User, err error)
func (SqlDataStore) GetUserByUsernameAndPassword ¶
func (ds SqlDataStore) GetUserByUsernameAndPassword(username string, password string) (user User, err error)
func (SqlDataStore) NewTokenForUser ¶
func (db SqlDataStore) NewTokenForUser(user User) (token string, err error)
type User ¶
type User struct { ID uint `gorm:"primary_key"` Username string Email string PasswordHash string PasswordResetToken string FirstName string LastName string IsBlocked bool Tokens []UserToken CreatedAt time.Time UpdatedAt time.Time PasswordLastChangedAt time.Time LastLoginAt time.Time FailedLoginAttempts int DeletedAt *time.Time }