api

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2025 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type API

type API struct {
	Router *mux.Router
	// contains filtered or unexported fields
}

API provides a struct to wrap the api around

func Setup

func Setup(ctx context.Context, isPublishing bool, r *mux.Router, dataStore DataStore, identityHandler func(http.Handler) http.Handler) *API

Setup function sets up the api and returns an API

func (*API) CreateOrUpdateCacheTime

func (api *API) CreateOrUpdateCacheTime(ctx context.Context, w http.ResponseWriter, req *http.Request)

CreateOrUpdateCacheTime handles the creation or update of a cache time

func (*API) GetCacheTime

func (api *API) GetCacheTime(ctx context.Context, w http.ResponseWriter, req *http.Request)

GetCacheTime retrieves a cache time for a given ID and writes it to the HTTP response.

type DataStore

type DataStore interface {
	Checker(ctx context.Context, state *healthcheck.CheckState) error
	Close(ctx context.Context) error
	IsConnected(ctx context.Context) bool
	GetCacheTime(ctx context.Context, id string) (*models.CacheTime, error)
	UpsertCacheTime(ctx context.Context, cacheTime *models.CacheTime) error
}

DataStore defines the behaviour of a DataStore

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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