server

package
v0.6.5 Latest Latest
Warning

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

Go to latest
Published: Jan 7, 2026 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ApiHandler added in v0.2.0

func ApiHandler(w http.ResponseWriter, r *http.Request)

helper function that selects the interface based on the URL path

func Auth

func Auth(next http.HandlerFunc) http.HandlerFunc

basic auth that uses public username/password for check (and if it's needed)

func ClearCache added in v0.6.0

func ClearCache()

reset cache (used for tests)

func CommitHandler added in v0.4.0

func CommitHandler(w http.ResponseWriter, r *http.Request)

write all cache to filesystem

func Configure added in v0.6.0

func Configure()

upon init, set credentials and filesystem to use

func PingHandler

func PingHandler(w http.ResponseWriter, r *http.Request)

does nothing, only used for health checks

func ValidPort added in v0.6.1

func ValidPort(s string) bool

used to check EM_PORT value

Types

type Cache added in v0.4.0

type Cache struct {
	// contains filtered or unexported fields
}

type Config

type Config struct {
	// contains filtered or unexported fields
}

type EntryItem

type EntryItem struct{}

func (EntryItem) Add

func (EntryItem) Add(request Request) Response

parses entry payload and updates the corresponding table

func (EntryItem) Del

func (EntryItem) Del(request Request) Response

fetches path for table name, then removes key from JSON.

func (EntryItem) Get added in v0.2.2

func (EntryItem) Get(request Request) Response

query for an entry in a table. Returns query result (and updates cache).

type Item

type Item interface {
	Add(request Request) Response
	Del(request Request) Response
	Get(request Request) Response
}

type Request added in v0.2.0

type Request struct {
	Method string // get, put, delete
	Table  string
	Key    []string
	Mode   string // increment, append, empty
	Value  any
}

type Response

type Response struct {
	Error error
	Data  any
}

type Session added in v0.4.0

type Session struct {
	// contains filtered or unexported fields
}

type TableItem

type TableItem struct{}

func (TableItem) Add

func (TableItem) Add(request Request) Response

parses payload of table, and creates it if it doesn't exist.

func (TableItem) Del

func (TableItem) Del(request Request) Response

check if table exists, if yes, remove table.

func (TableItem) Get added in v0.2.2

func (TableItem) Get(request Request) Response

queries tables (so not table contents)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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