Documentation
¶
Overview ¶
Package fixture holds the DTOs of the generator's test registry: every mapping case of encoding/json the generator follows. Only the tests import it.
Index ¶
- type Attachment
- type Audit
- type Cents
- type Code
- type Color
- type CreateEmbedded
- type CreateHidden
- type CreateLabel
- type CreateNote
- type CreatePart
- type CreateThroughPointer
- type Dashboard
- type DecodesItself
- type Dimensions
- type EmbedsDecoder
- type HoldsStringer
- type HoldsTextBytes
- type HoldsTextKeys
- type HoldsTextOnly
- type JSONOnly
- type JSONWithText
- type Kind
- type Node
- type Note
- type Owner
- type Page
- type Part
- type PointerCodec
- type Primary
- type Raw
- type RenamePart
- type Secondary
- type Stat
- type Tags
- type TextBytes
- type TextKey
- type TextOnly
- type TextReader
- type TextString
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Attachment ¶
type Attachment struct {
ID uuid.UUID `json:"id"`
Size int64 `json:"size"`
Type string `json:"type"`
}
Attachment answers the upload.
type Audit ¶
type Audit struct {
CreatedAt time.Time `json:"createdAt"`
UpdatedAt *time.Time `json:"updatedAt"`
}
Audit is embedded by value and flattened.
type Code ¶
type Code struct {
// contains filtered or unexported fields
}
Code marshals itself as text.
func (*Code) UnmarshalText ¶
UnmarshalText reads the code, so the Go client decodes what the server wrote.
type Color ¶
type Color string
Color is a named string type without listed values: an alias of string.
type CreateEmbedded ¶
CreateEmbedded is a create body whose JSON id lives in an embedded struct, beside another embedded field ID: the client fills body.Primary.ID.
type CreateHidden ¶
type CreateHidden struct {
Name string `json:"name"`
// contains filtered or unexported fields
}
CreateHidden promotes its JSON id from an unexported embedded struct: the client fills body.ID, which compiles from another package.
type CreateLabel ¶
CreateLabel is a create body whose client id is a named string.
type CreateNote ¶
CreateNote is a create body whose client id is a pointer.
type CreatePart ¶
type CreatePart struct {
ID uuid.UUID `json:"id,omitzero"`
Name string `json:"name" validate:"required"`
Kind Kind `json:"kind"`
}
CreatePart is the body of the create mutation; its id is the client's (D18).
type CreateThroughPointer ¶
CreateThroughPointer promotes its id through an embedded pointer, which may be nil: the client refuses to fill it.
type Dashboard ¶
type Dashboard struct {
Title string `json:"title"`
Pages []Page[Stat] `json:"pages"`
Tree Node `json:"tree"`
Limit time.Duration `json:"limit"`
}
Dashboard is the item of the test object.
type DecodesItself ¶
DecodesItself has UnmarshalJSON, so the field it holds is its own business: decodes.
func (*DecodesItself) UnmarshalJSON ¶
func (*DecodesItself) UnmarshalJSON([]byte) error
UnmarshalJSON reads anything.
type Dimensions ¶
Dimensions is embedded under a JSON name, so it is one field.
type EmbedsDecoder ¶
type EmbedsDecoder struct {
DecodesItself
}
EmbedsDecoder decodes through the UnmarshalJSON it promotes.
type HoldsStringer ¶
HoldsStringer has an interface field with methods, which encoding/json cannot fill.
type HoldsTextBytes ¶
type HoldsTextBytes struct {
Data TextBytes `json:"data"`
}
HoldsTextBytes has a TextBytes field.
type HoldsTextKeys ¶
HoldsTextKeys has a map of TextKey keys.
type HoldsTextOnly ¶
type HoldsTextOnly struct {
Inner []TextOnly `json:"inner"`
}
HoldsTextOnly reaches TextOnly through a field.
type JSONOnly ¶
type JSONOnly struct{}
JSONOnly marshals itself but reads nothing back: refused.
func (JSONOnly) MarshalJSON ¶
MarshalJSON writes a string the struct cannot be read from.
type JSONWithText ¶
type JSONWithText struct {
// contains filtered or unexported fields
}
JSONWithText writes a JSON string and reads it back through UnmarshalText: decodes.
func (JSONWithText) MarshalJSON ¶
func (j JSONWithText) MarshalJSON() ([]byte, error)
MarshalJSON writes the value as a JSON string.
func (*JSONWithText) UnmarshalText ¶
func (j *JSONWithText) UnmarshalText(text []byte) error
UnmarshalText reads the string.
type Part ¶
type Part struct {
Audit
*Owner
Dimensions `json:"dimensions"`
ID uuid.UUID `json:"id"`
Name string `json:"name"`
Kind Kind `json:"kind"`
Color Color `json:"color"`
Price *float64 `json:"price"`
Secret string `json:"secret"`
Notes string `json:"notes,omitempty"`
Previous *Kind `json:"previous,omitempty"`
Tags Tags `json:"tags"`
Labels []string `json:"labels,omitempty"`
Sizes []string `json:"sizes" enum:"s,m,l"`
Grade string `json:"grade" enum:"a,b"`
Counts map[string]int `json:"counts"`
Names map[int]string `json:"names,omitzero"`
Children []*Part `json:"children"`
Matrix [3]int `json:"matrix"`
Checksum []byte `json:"checksum"`
Total Cents `json:"total"`
Large int64 `json:"large,string"`
Flag *bool `json:"flag,string"`
Version int `json:"version"`
Expires time.Time `json:"expires,omitzero"`
Started time.Time `json:"started,omitempty"`
Extra json.RawMessage `json:"extra"`
Anything any `json:"anything"`
Payload Raw `json:"payload"`
Code Code `json:"code"`
ContentType string `json:"content-type"`
Dash string `json:"-,"` //nolint:staticcheck // SA5008: the key "-", a mapping case under test
Skipped string `json:"-"`
Inline struct{ A int } `json:"inline"`
Metadata map[string]string `json:"metadata,omitempty"`
// contains filtered or unexported fields
}
Part is the item of the test resource.
type PointerCodec ¶
type PointerCodec struct {
// contains filtered or unexported fields
}
PointerCodec marshals and unmarshals through pointer receivers: decodes.
func (*PointerCodec) MarshalJSON ¶
func (p *PointerCodec) MarshalJSON() ([]byte, error)
MarshalJSON writes the value.
func (*PointerCodec) UnmarshalJSON ¶
func (p *PointerCodec) UnmarshalJSON(data []byte) error
UnmarshalJSON reads the value.
type Raw ¶
type Raw struct{}
Raw marshals itself: nothing is known about its JSON.
func (Raw) MarshalJSON ¶
MarshalJSON writes an empty object.
func (*Raw) UnmarshalJSON ¶
UnmarshalJSON reads what MarshalJSON wrote: a type that marshals itself must unmarshal itself, or the Go client refuses it (D67).
type RenamePart ¶
type RenamePart struct {
Name string `json:"name"`
}
RenamePart is the body of the rename mutation.
type TextBytes ¶
type TextBytes []byte
TextBytes is a byte slice with UnmarshalText only: encoding/json writes it as a base64 string and reads that string back through UnmarshalText, so it decodes.
func (*TextBytes) UnmarshalText ¶
UnmarshalText keeps the text it is given, the base64 encoding/json wrote.
type TextKey ¶
type TextKey struct {
// contains filtered or unexported fields
}
TextKey is a map key that marshals itself as text only: refused as a key.
func (TextKey) MarshalText ¶
MarshalText writes the key.
type TextOnly ¶
type TextOnly struct {
// contains filtered or unexported fields
}
TextOnly marshals itself as text but cannot read it back: the Go client refuses it.
func (TextOnly) MarshalText ¶
MarshalText writes the value.
type TextReader ¶
type TextReader struct {
Name string `json:"name"`
}
TextReader is a struct with UnmarshalText only: written as an object, which UnmarshalText cannot read; refused.
func (*TextReader) UnmarshalText ¶
func (t *TextReader) UnmarshalText(text []byte) error
UnmarshalText reads a name.
type TextString ¶
type TextString string
TextString is a string kind with MarshalText: encoding/json reads the text as the string.
func (TextString) MarshalText ¶
func (t TextString) MarshalText() ([]byte, error)
MarshalText writes the string upper-cased.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package billing holds DTOs whose Go names repeat the fixture package's: the generator qualifies both with their package's name.
|
Package billing holds DTOs whose Go names repeat the fixture package's: the generator qualifies both with their package's name. |
|
Package fixtureclient is the Go client of the API at /api/v1 (D19, D67), generated from its livewire registry: build a Client with New and call one method per read, mutation, upload and export.
|
Package fixtureclient is the Go client of the API at /api/v1 (D19, D67), generated from its livewire registry: build a Client with New and call one method per read, mutation, upload and export. |
|
Package fixturecommand is the command-line client fixture of the API at /api/v1 (D19, D20), on github.com/urfave/cli/v3, generated from its livewire registry: one command per declaration and read kind, the parameters as flags, a body as --body or on stdin, the answers as JSON on stdout and the diagnostics on stderr.
|
Package fixturecommand is the command-line client fixture of the API at /api/v1 (D19, D20), on github.com/urfave/cli/v3, generated from its livewire registry: one command per declaration and read kind, the parameters as flags, a body as --body or on stdin, the answers as JSON on stdout and the diagnostics on stderr. |