Documentation ¶
Index ¶
- func HealthGet(ctx *fasthttp.RequestCtx)
- type API
- type Instance
- func (i *Instance) AddAPI(ctx *fasthttp.RequestCtx)
- func (i *Instance) AddSeed(ctx *fasthttp.RequestCtx)
- func (i *Instance) GetInfoAPI(ctx *fasthttp.RequestCtx)
- func (i *Instance) GetPetname(ctx *fasthttp.RequestCtx)
- func (i *Instance) ReloadAPI(ctx *fasthttp.RequestCtx)
- func (i *Instance) RemoveSeed(ctx *fasthttp.RequestCtx)
- func (i *Instance) SetupAPI(name string, lock bool, template string) bool
- func (i *Instance) SetupRouter()
- func (i *Instance) Start(port int)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func HealthGet ¶ added in v0.1.0
func HealthGet(ctx *fasthttp.RequestCtx)
HealthGet is the health handler (always return 200)
Types ¶
type API ¶
type API struct { Name string `json:"name"` Lock bool `json:"lock"` Token []string `json:"token,omitempty"` Generator *generator.Generator `json:"generator,omitempty"` }
API represents an API access point
type Instance ¶
type Instance struct { Router *fasthttprouter.Router API map[string]API }
Instance is a structure that stores the router
func (*Instance) AddAPI ¶ added in v0.1.0
func (i *Instance) AddAPI(ctx *fasthttp.RequestCtx)
AddAPI adds an API endpoint
func (*Instance) AddSeed ¶ added in v0.1.0
func (i *Instance) AddSeed(ctx *fasthttp.RequestCtx)
AddSeed adds a seed to a specific api endpoint note that duplicate seed is explicitly allowed in order to allow for increasing odds as well as to allow some names to pop up twice
func (*Instance) GetInfoAPI ¶ added in v0.1.0
func (i *Instance) GetInfoAPI(ctx *fasthttp.RequestCtx)
GetInfoAPI returns informations about a specific API
func (*Instance) GetPetname ¶ added in v0.1.0
func (i *Instance) GetPetname(ctx *fasthttp.RequestCtx)
GetPetname returns petname when queried
func (*Instance) ReloadAPI ¶ added in v0.1.0
func (i *Instance) ReloadAPI(ctx *fasthttp.RequestCtx)
ReloadAPI cleans the Used binary tree for a specific API
func (*Instance) RemoveSeed ¶ added in v0.1.0
func (i *Instance) RemoveSeed(ctx *fasthttp.RequestCtx)
RemoveSeed removes a seed to a specific api endpoint
func (*Instance) SetupRouter ¶
func (i *Instance) SetupRouter()
SetupRouter generates the initial router configurations for the petname API server
Click to show internal directories.
Click to hide internal directories.