shortry

package
v0.22.2 Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2024 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package shortry simplifies action assignment.

Please note that the API and the functionality are not yet set, things may change in the future.

No validation is performed at the moment. If you input is crap, crap comes out.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotExists = errors.New("no pattern found for key")
	ErrAmbiguous = errors.New("key matches multiple patterns")
	ErrForbidden = errors.New("key contains forbidden characters")
)

Functions

This section is empty.

Types

type Shortry

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

func New

func New(m map[string]interface{}) *Shortry

New returns a new Shortry.

func (*Shortry) Exists

func (s *Shortry) Exists(key string) bool

Exists returns true if there exists a pattern that matches to key.

func (*Shortry) Get

func (s *Shortry) Get(key string) (interface{}, error)

Get value for key, if possible.

func (*Shortry) GetAll

func (s *Shortry) GetAll(key string) []interface{}

Get values for all keys given, in order.

func (*Shortry) Matches

func (s *Shortry) Matches(key string) []string

Matches returns a list of matching patterns.

func (*Shortry) Unique

func (s *Shortry) Unique(key string) bool

Unique returns whether there exists a only one pattern that matches to key.

Jump to

Keyboard shortcuts

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