Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ArgumentDeleter ¶
type ArgumentDeleter interface { // Delete deletes an argument (and all its versions) from the site. // If the argument didn't exist, the error will be a NotFoundError. Delete(ctx context.Context, id int64) error }
ArgumentDeleter can delete arguments by ID.
type ArgumentGetterByVersion ¶
type ArgumentGetterByVersion interface { // FetchVersion should return a particular version of an argument. // If the the argument didn't exist, the error should be an arguments.NotFoundError. FetchVersion(ctx context.Context, id int64, version int) (arguments.Argument, error) }
ArgumentGetterByVersion returns a specific version of an argument.
type ArgumentGetterLiveVersion ¶
type ArgumentGetterLiveVersion interface { // FetchLive should return the latest "active" version of an argument. // If no argument with this ID exists, the error should be an arguments.NotFoundError. FetchLive(ctx context.Context, id int64) (arguments.Argument, error) }
ArgumentGetterLiveVersion can fetch the live version of an argument.
type ArgumentSaver ¶
type ArgumentSaver interface { // Save stores an argument and returns that argument's ID. // The ID on the input argument will be ignored. Save(ctx context.Context, argument arguments.Argument) (id int64, err error) }
ArgumentSaver can save arguments.
type ArgumentUpdater ¶
type ArgumentUpdater interface { // Update makes a new version of the argument. It returns the new argument's version. // If no argument with this ID exists, the returned error is an arguments.NotFoundError. Update(ctx context.Context, argument arguments.Argument) (version int, err error) }
ArgumentUpdater can update existing arguments.
type ArgumentsGetter ¶
type ArgumentsGetter interface { // FetchSome finds the arguments which match the options. // If none exist, error will be nil and the slice empty. FetchSome(ctx context.Context, options arguments.FetchSomeOptions) ([]arguments.Argument, error) }
ArgumentsGetter can fetch lists of arguments at once.
type GetAllResponse ¶
GetAllResponse is the contract class for the GET /arguments?conclusion=foo endpoint
type GetOneResponse ¶
GetOneResponse is the contract class for JSON responses of a single argument.
Examples include:
GET /argument/{id} GET /argument/{id}/version/{version} POST /arguments PATCH /argument?id=1
etc.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server runs the service. Use NewServer() to construct one from an app config, and Start() to make it start listening and serving requests.
type Store ¶
type Store interface { ArgumentDeleter ArgumentsGetter ArgumentGetterByVersion ArgumentGetterLiveVersion ArgumentSaver ArgumentUpdater }
Store has all the functions needed by the server for persistent storage