comparabletypes

package
v0.0.10 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2023 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultContextSize = 3
View Source
const KindJSON snapshots.Kind = "json"
View Source
const KindString snapshots.Kind = "string"

Variables

This section is empty.

Functions

func NewJSONFromByes added in v0.0.6

func NewJSONFromByes(b []byte) snapshots.Comparable

func NewJSONFromString

func NewJSONFromString(s string) snapshots.Comparable

func NewPrettyStringComparable

func NewPrettyStringComparable(s string) snapshots.Comparable

NewPrettyStringComparable constructs a PrettyStringComparable from a string.

func NewStringComparable

func NewStringComparable(s string) snapshots.Comparable

NewStringComparable constructs a StringComparable from a string.

Types

type JSON

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

func (*JSON) CompareTo

func (j *JSON) CompareTo(c snapshots.Comparable) (string, error)

func (*JSON) Dump

func (j *JSON) Dump() []byte

func (*JSON) Extension

func (j *JSON) Extension() string

func (*JSON) Kind

func (j *JSON) Kind() snapshots.Kind

func (*JSON) Load

func (j *JSON) Load(rawJSON []byte) snapshots.Comparable

func (*JSON) Replace

func (j *JSON) Replace(rs map[string]string)

func (*JSON) ReplaceSubtypes added in v0.0.8

func (j *JSON) ReplaceSubtypes(_ map[snapshots.Kind]map[string]string)

func (*JSON) String

func (j *JSON) String() string

func (*JSON) Subtypes added in v0.0.8

func (j *JSON) Subtypes() bool

type PrettyStringComparable

type PrettyStringComparable struct {
	StringComparable
}

func (*PrettyStringComparable) CompareTo

func (*PrettyStringComparable) Load

type Response

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

Response holds comparable information of a http response.

func NewResponse

func NewResponse(r *http.Response, pretty bool) (*Response, error)

NewResponse returns a new instance of Response

func (*Response) CompareTo

func (r *Response) CompareTo(c snapshots.Comparable) (string, error)

func (*Response) Dump

func (r *Response) Dump() []byte

func (*Response) Extension

func (r *Response) Extension() string

func (*Response) Kind

func (r *Response) Kind() snapshots.Kind

func (*Response) Load

func (r *Response) Load(req []byte) snapshots.Comparable

func (*Response) RegisterHandler

func (r *Response) RegisterHandler(contentType string, h func(string) snapshots.Comparable)

RegisterHandler will store in the response comparable a handler for a content-type

func (*Response) Replace

func (r *Response) Replace(m map[string]string)

func (*Response) ReplaceSubtypes added in v0.0.8

func (r *Response) ReplaceSubtypes(replacers map[snapshots.Kind]map[string]string)

func (*Response) String

func (r *Response) String() string

func (*Response) Subtypes added in v0.0.8

func (r *Response) Subtypes() bool

type StringComparable

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

func (*StringComparable) CompareTo

func (s *StringComparable) CompareTo(c snapshots.Comparable) (string, error)

func (*StringComparable) Dump

func (s *StringComparable) Dump() []byte

func (*StringComparable) Extension

func (s *StringComparable) Extension() string

func (*StringComparable) Kind

func (s *StringComparable) Kind() snapshots.Kind

func (*StringComparable) Load

func (s *StringComparable) Load(rawS []byte) snapshots.Comparable

func (*StringComparable) Replace

func (s *StringComparable) Replace(r map[string]string)

func (*StringComparable) ReplaceSubtypes added in v0.0.8

func (s *StringComparable) ReplaceSubtypes(_ map[snapshots.Kind]map[string]string)

func (*StringComparable) String

func (s *StringComparable) String() string

func (*StringComparable) Subtypes added in v0.0.8

func (s *StringComparable) Subtypes() bool

Jump to

Keyboard shortcuts

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