types

package
v0.29.0 Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2023 License: MPL-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ContentType = "application/json"
)

Variables

View Source
var (

	// ErrBadIdentifier indicates a bad identifer pattern
	ErrBadIdentifier = errors.New("invalid identifier, must match " + idRegexp)
)

Functions

func EncodeResponse

func EncodeResponse(_ context.Context, w http.ResponseWriter, response interface{}) error

Types

type ErrorRes

type ErrorRes struct {
	Err string `json:"error"`
}

type Identifier

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

func NewIdentifier

func NewIdentifier(v string) (Identifier, error)

func (*Identifier) IsValid

func (i *Identifier) IsValid() bool

func (*Identifier) Scan

func (i *Identifier) Scan(value interface{}) error

Scan - Implement the database/sql scanner interface

func (*Identifier) String

func (i *Identifier) String() string

func (Identifier) Value

func (i Identifier) Value() (driver.Value, error)

Value Implements valuer

type Metadata

type Metadata map[string]interface{}

Metadata Maybe a full object hierarchy

func FromMap added in v0.26.0

func FromMap(m map[string]interface{}) Metadata

func (*Metadata) FilterMap

func (s *Metadata) FilterMap(predicateFunc func(string) bool, mapFunc func(string, interface{}) (string, interface{}))

func (*Metadata) GetSubMetadata added in v0.26.0

func (s *Metadata) GetSubMetadata(key string) Metadata

GetSubMetadata gets the first substructure with the keyname or nil

func (*Metadata) IsApplicable

func (s *Metadata) IsApplicable(filterFunc func(string, interface{}) bool) bool

func (*Metadata) Merge

func (s *Metadata) Merge(metadataToAdd Metadata)

func (*Metadata) RemoveKeys

func (s *Metadata) RemoveKeys(keys []string)

func (*Metadata) RestrictKeys

func (s *Metadata) RestrictKeys(predicate func(string) bool)

func (*Metadata) Scan

func (s *Metadata) Scan(src interface{}) error

type Response

type Response interface {
	// Code returns HTTP response code.
	Code() int

	// Headers returns map of HTTP headers with their values.
	Headers() map[string]string

	// Empty indicates if HTTP response has content.
	Empty() bool
}

Response contains HTTP response specific methods.

type Tags

type Tags map[string]string

Tags A flat kv pair object

func (*Tags) Merge

func (t *Tags) Merge(newTags map[string]string)

Jump to

Keyboard shortcuts

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