gondulapi

package module
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2020 License: GPL-2.0 Imports: 4 Imported by: 0

README

Gondul API
==========

This is the re-implementation of the Gondul API, in Go, and it is nowhere
near complete.

Do not use it.

There's a database password hardcoded in there. That's because it's a very
good password so there is no reason to change it.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Config struct {
	ListenAddress    string // Defaults to :8080
	ConnectionString string // For database connections
	Prefix           string // URL prefix, e.g. "/api".
	Debug            bool   // Enables trace-debugging
}

Config covers global configuration, and if need be it will provide mechanisms for local overrides (similar to Skogul).

Functions

func ParseConfig

func ParseConfig(file string) error

ParseConfig reads a file and parses it as JSON, assuming it will be a valid configuration file.

Types

type Deleter

type Deleter interface {
	Delete(element string) error
}

Deleter should delete the object identified by the element. It should be idempotent, in that it should be safe to call it on already-deleted items.

type Error

type Error struct {
	Code    int
	Message string
}

Error is used to combine a text-based error with a HTTP error code.

func Errorf

func Errorf(code int, str string, v ...interface{}) Error

Errorf is a convenience-function to provide an Error data structure, which is essentially the same as fmt.Errorf(), but with an HTTP status code embedded into it which can be extracted.

func (Error) Error

func (e Error) Error() string

Error allows Error to implement the error interface. That's a whole lot of error in one sentence...

type Getter

type Getter interface {
	Get(element string) error
}

Getter implements Get method, which should fetch the object represented by the element path.

type Poster

type Poster interface {
	Post() error
}

Poster is not necessarily idempotent, but can be. It should write the object provided, potentially generating a new ID for it if one isn't provided in the data structure itself.

type Putter

type Putter interface {
	Put(element string) error
}

Putter is an idempotent method that requires an absolute path. It should (over-)write the object found at the element path.

Directories

Path Synopsis
cmd
test command
Package db integrates with generic databases, so far it doesn't do much, but it's supposed to do more.
Package db integrates with generic databases, so far it doesn't do much, but it's supposed to do more.
Package objects implements a number of objects.
Package objects implements a number of objects.
Package receiver is scaffolding around net/http that facilitates a RESTful HTTP API with certain patterns implicitly enforced: - When working on the same urls, all Methods should use the exact same data structures.
Package receiver is scaffolding around net/http that facilitates a RESTful HTTP API with certain patterns implicitly enforced: - When working on the same urls, all Methods should use the exact same data structures.

Jump to

Keyboard shortcuts

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