handlers

package
v0.0.0-...-3c1a35f Latest Latest
Warning

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

Go to latest
Published: May 29, 2019 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddItem

func AddItem(item *models.Item) error

AddItem creates a new item

func AllItems

func AllItems(since int64, limit int32) (results []*models.Item)

AllItems returns all the items

func DeleteItem

func DeleteItem(id int64) error

DeleteItem removes a single item from items

func GetItem

func GetItem(id int64) (item *models.Item, err error)

GetItem returns a single item

func LivenessCheck

func LivenessCheck() (check *models.Liveness, err error)

LivenessCheck returns true

func ReadinessCheck

func ReadinessCheck() (check *models.Readiness, err error)

ReadinessCheck returns true

func TokenAuth

func TokenAuth(token string) (*models.Principal, error)

TokenAuth gets token from Cfg

func UpdateItem

func UpdateItem(id int64, item *models.Item) error

UpdateItem updates a single item

Types

type SpoonCfg

type SpoonCfg struct {
	Host  string `env:"SPOON_URL" envDefault:"0.0.0.0"`
	Port  string `env:"SPOON_PORT" envDefault:"30570"`
	Token string `env:"SPOON_TOKEN" envDefault:"1234567890"`
	State string `env:"SPOON_STATE" envDefault:"stateless"`
}

SpoonCfg Cfg for app

func GetCfg

func GetCfg() (*SpoonCfg, error)

GetCfg get the cfg from os.Environ

type SpoonDbCfg

type SpoonDbCfg struct {
	Host   string `env:"SPOON_DATABASE_HOSTNAME" envDefault:"0.0.0.0"`
	Port   string `env:"SPOON_DATABASE_PORT" envDefault:"5432"`
	User   string `env:"SPOON_DATABASE_USER" envDefault:"postgres"`
	Passwd string `env:"SPOON_DATABASE_PASSWD" envDefault:"admin"`
	Name   string `env:"SPOON_DATABASE_NAME" envDefault:"spoons"`
}

SpoonDbCfg config for the database connections

func GetDbCfg

func GetDbCfg() (*SpoonDbCfg, error)

GetDbCfg get the cfg from os.Environ

Jump to

Keyboard shortcuts

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