storage

package
v2.6.0 Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package storage contains storage of the internal handlers. Thread-safe put/get by string key.

Index

Constants

This section is empty.

Variables

View Source
var ErrRouteNotFound = errors.New("route not found")

ErrRouteNotFound returns when storage can't found handler by route.

Functions

This section is empty.

Types

type Storage

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

Storage thread-safe map handlers by string routers.

func New

func New() *Storage

New returns new storage.

func (*Storage) Get

func (s *Storage) Get(route string) (any, error)

Get returns handler from storage by route key. Returns error if route does not exist in storage.

func (*Storage) Put

func (s *Storage) Put(route string, value any)

Put puts new handler into storage.

Jump to

Keyboard shortcuts

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