backend

package
v0.0.0-...-4d2a565 Latest Latest
Warning

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

Go to latest
Published: May 13, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package backend provides an in-memory thread-safe data store for creating and accessing geospatial.State objects. This data store implements the methods that satisfy the [server.StateLocationDataProvider] interface used by the state-server API webserver

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type InvalidStateError

type InvalidStateError struct {
	Err error
}

Error struct which implements the Error interface and allows HTTP request handlers to generate the appropriate response

func (*InvalidStateError) Error

func (e *InvalidStateError) Error() string

type StateLocationMemoryStore

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

func NewMemoryStore

func NewMemoryStore() *StateLocationMemoryStore

Constructor for the StateLocationMemoryStore struct instaniates the data store with a string formatter for title-casing state names in a standardized manner

func (*StateLocationMemoryStore) Create

Validates a provided geospatial.State object and adds it to the data store. Returns InvalidStateError is the geospatial.State provided is invalid.

func (*StateLocationMemoryStore) Delete

func (s *StateLocationMemoryStore) Delete(name string) error

Removes the geospatial.State with the provided name from the data store collection if it exists.

func (*StateLocationMemoryStore) GetAll

Gets the entire collection of geospatial.State objects from the data store

func (*StateLocationMemoryStore) GetByName

func (s *StateLocationMemoryStore) GetByName(name string) (geospatial.State, error)

Gets a single geospatial.State object from the data store. Returns StateNotFoundError if no state exists for the given name

type StateNotFoundError

type StateNotFoundError struct {
	Name string
}

Error struct which implements the Error interface and allows HTTP request handlers to generate the appropriate response

func (*StateNotFoundError) Error

func (e *StateNotFoundError) Error() string

Jump to

Keyboard shortcuts

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