stuber

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2024 License: MIT Imports: 13 Imported by: 0

README

stuber

Documentation

Index

Constants

View Source
const (
	MethodTitle features.Flag = iota
)
View Source
const (
	RequestInternalFlag features.Flag = iota
)

Variables

View Source
var (
	ErrServiceNotFound = errors.New("service not found")
	ErrMethodNotFound  = errors.New("method not found")
	ErrStubNotFound    = errors.New("stub not found")
)
View Source
var (
	ErrLeftNotFound  = errors.New("left not found")
	ErrRightNotFound = errors.New("right not found")
)

Functions

This section is empty.

Types

type Budgerigar

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

func NewBudgerigar

func NewBudgerigar(toggles features.Toggles) *Budgerigar

func (*Budgerigar) All

func (b *Budgerigar) All() []*Stub

func (*Budgerigar) Clear

func (b *Budgerigar) Clear()

func (*Budgerigar) DeleteByID

func (b *Budgerigar) DeleteByID(ids ...uuid.UUID) int

func (*Budgerigar) FindBy

func (b *Budgerigar) FindBy(service, method string) ([]*Stub, error)

func (*Budgerigar) FindByID

func (b *Budgerigar) FindByID(id uuid.UUID) *Stub

func (*Budgerigar) FindByQuery

func (b *Budgerigar) FindByQuery(query Query) (*Result, error)

func (*Budgerigar) PutMany

func (b *Budgerigar) PutMany(values ...*Stub) []uuid.UUID

func (*Budgerigar) Unused

func (b *Budgerigar) Unused() []*Stub

func (*Budgerigar) Used

func (b *Budgerigar) Used() []*Stub

type InputData

type InputData struct {
	IgnoreArrayOrder bool                   `json:"ignoreArrayOrder,omitempty"`
	Equals           map[string]interface{} `json:"equals"`
	Contains         map[string]interface{} `json:"contains"`
	Matches          map[string]interface{} `json:"matches"`
}

func (InputData) GetContains

func (i InputData) GetContains() map[string]interface{}

func (InputData) GetEquals

func (i InputData) GetEquals() map[string]interface{}

func (InputData) GetMatches

func (i InputData) GetMatches() map[string]interface{}

type InputHeader

type InputHeader struct {
	Equals   map[string]interface{} `json:"equals"`
	Contains map[string]interface{} `json:"contains"`
	Matches  map[string]interface{} `json:"matches"`
}

func (InputHeader) GetContains

func (i InputHeader) GetContains() map[string]interface{}

func (InputHeader) GetEquals

func (i InputHeader) GetEquals() map[string]interface{}

func (InputHeader) GetMatches

func (i InputHeader) GetMatches() map[string]interface{}

func (InputHeader) Len

func (i InputHeader) Len() int

type Output

type Output struct {
	Headers map[string]string      `json:"headers"`
	Data    map[string]interface{} `json:"data"`
	Error   string                 `json:"error"`
	Code    *codes.Code            `json:"code,omitempty"`
}

type Query

type Query struct {
	ID      *uuid.UUID             `json:"id,omitempty"`
	Service string                 `json:"service"`
	Method  string                 `json:"method"`
	Headers map[string]interface{} `json:"headers"`
	Data    map[string]interface{} `json:"data"`
	// contains filtered or unexported fields
}

func NewQuery

func NewQuery(r *http.Request) (Query, error)

func (Query) RequestInternal

func (q Query) RequestInternal() bool

type Result

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

func (*Result) Found

func (r *Result) Found() *Stub

func (*Result) Similar

func (r *Result) Similar() *Stub

type Stub

type Stub struct {
	ID      uuid.UUID   `json:"id"`
	Service string      `json:"service"`
	Method  string      `json:"method"`
	Headers InputHeader `json:"headers"`
	Input   InputData   `json:"input"`
	Output  Output      `json:"output"`
}

func (Stub) Key

func (s Stub) Key() uuid.UUID

func (Stub) Left

func (s Stub) Left() string

func (Stub) Right

func (s Stub) Right() string

type Value

type Value interface {
	Key() uuid.UUID
	Left() string
	Right() string
}

Jump to

Keyboard shortcuts

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