state

package
v0.0.0-...-a783d1e Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 21, 2019 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewStageStorage

func NewStageStorage(u *User) *cache.Cache

NewStageStorage creates a state storage interface that supports creating a new one, or using an already existing one

Types

type State

type State struct {
	DB *sql.DB
}

State is the interface to the state object

func NewClient

func NewClient(path string) (*State, error)

NewClient creates a new client for accessing the state.

func (*State) CreateUser

func (s *State) CreateUser(id int, username string) (*User, error)

CreateUser creates a user.

func (*State) GetUserByID

func (s *State) GetUserByID(id int) (*User, error)

GetUserByID gets a user by their ID

func (*State) GetUserByUsername

func (s *State) GetUserByUsername(username string) (*User, error)

GetUserByUsername gets a user by their Username. DEPRECATED.

func (*State) IsNotFound

func (s *State) IsNotFound(err error) bool

IsNotFound checks if the error type is a "not found" error type.

func (*State) ListUsers

func (s *State) ListUsers() ([]User, error)

ListUsers returns a list of ALLLLL the users.

func (*State) SetStage

func (s *State) SetStage(id int, stage string) error

SetStage sets the stage a user is at

type User

type User struct {
	ID       int
	Username string
	Stage    string // stage the user is at "context"
}

User is a user object

type UserData

type UserData map[string]interface{}

UserData is a key value store for embedding data that can be checked by an application later

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL