Documentation
¶
Overview ¶
Code generated by ycat; DO NOT EDIT.
Index ¶
- Constants
- func Drain(s Stream) bool
- func EvalFilename() (string, error)
- func MarshalJSONString(x interface{}) (string, error)
- func MergeErrors(cs ...<-chan error) <-chan error
- type Consumer
- type ConsumerFunc
- type Debug
- type Decoder
- type Eval
- type Format
- type JSONStringMarshaler
- type Map
- type NullStream
- type Output
- type Pipeline
- type Producer
- type ProducerFunc
- type Producers
- type RawValue
- func (v RawValue) Compact() (RawValue, error)
- func (v RawValue) Kind() ValueType
- func (v RawValue) MarshalJSON() ([]byte, error)
- func (v RawValue) MarshalJSONString() string
- func (v RawValue) MarshalYAML() (x interface{}, err error)
- func (v RawValue) String() string
- func (v *RawValue) UnmarshalJSON(data []byte) error
- func (v *RawValue) UnmarshalYAML(fn func(interface{}) error) (err error)
- type ReadStream
- type Stream
- type StreamFunc
- type StreamTask
- type ToArray
- type ValueType
- type Var
- type VarType
- type WriteStream
Constants ¶
const DefaultInputVar = "x"
DefaultInputVar is the default name for the stream value
const EnvDefaultFormat = "YCAT_FORMAT"
EnvDefaultFormat is the name of the env var for file format detection
const EnvDefaultOutput = "YCAT_OUTPUT"
EnvDefaultOutput is the name of the env var for default file output
const Usage = `` /* 1599-byte string literal not displayed */
Usage for ycat cmd
Variables ¶
This section is empty.
Functions ¶
func EvalFilename ¶ added in v0.2.0
EvalFilename returns a filename on CWD
func MarshalJSONString ¶ added in v0.2.3
MarshalJSONString marshals any value to JSON string
func MergeErrors ¶
MergeErrors is a helper function that merges error channels
Types ¶
type Consumer ¶ added in v0.2.3
type Consumer interface {
Consume(s ReadStream) error
}
Consumer consumes values from a readable stream
type ConsumerFunc ¶ added in v0.2.3
type ConsumerFunc func(s ReadStream) error
ConsumerFunc is a Consumer callback
func StreamWriteJSON ¶ added in v0.2.3
func StreamWriteJSON(w io.WriteCloser) ConsumerFunc
StreamWriteJSON creates a StreamTask to write values as JSON to a Writer
func StreamWriteYAML ¶ added in v0.2.3
func StreamWriteYAML(w io.WriteCloser) ConsumerFunc
StreamWriteYAML creates a StreamTask to write values as YAML to a Writer
func (ConsumerFunc) Consume ¶ added in v0.2.3
func (f ConsumerFunc) Consume(s ReadStream) error
Consume implements Consumer
func (ConsumerFunc) Run ¶ added in v0.2.3
func (f ConsumerFunc) Run(s Stream) error
Run implements StreamTask
type Eval ¶
type Eval struct {
Bind string
MaxStackSize int
Array bool
Vars map[string]Var
// contains filtered or unexported fields
}
Eval is the execution environment for Jsonnet
func (*Eval) Snippet ¶
func (e *Eval) Snippet(filename, snippet string) StreamTask
EvalSnippetTask transforms a stream of input values with Jsonnet
func (*Eval) SnippetFromFile ¶ added in v0.2.4
func (e *Eval) SnippetFromFile(filename string) StreamTask
type Format ¶
type Format uint
Format is input file format
func DefaultFormat ¶ added in v0.2.4
func DefaultFormat() Format
DefaultFormat returns the default format from environment
func DetectFormat ¶
DetectFormat detects an input format from the extension
func FormatFromString ¶
FormatFromString converts a string to Format
type JSONStringMarshaler ¶ added in v0.2.3
JSONStringMarshaler marshals to JSON string
type Map ¶ added in v0.2.3
Map wraps yaml.MapSlice to provide json Marshaler/Unmarshaller
func NewMap ¶ added in v0.2.3
func NewMap(pairs ...interface{}) (m Map)
NewMap creates a Map from key/value pairs
func (Map) MarshalJSON ¶ added in v0.2.3
MarshalJSON implements json.Marshaler for Map
func (Map) MarshalJSONString ¶ added in v0.2.3
MarshalJSONString implements JSONStringMarshaler for Map
func (Map) MarshalYAML ¶ added in v0.2.3
MarshalYAML implements yaml.Marshaler for Map
func (*Map) UnmarshalJSON ¶ added in v0.2.3
UnmarshalJSON implements json.Unmarshaler for Map
func (*Map) UnmarshalYAML ¶ added in v0.2.3
UnmarshalYAML implements yaml.Unmarshaler for Map
type NullStream ¶ added in v0.2.0
type NullStream struct{}
NullStream is a Producer that pushes a null
func (NullStream) Produce ¶ added in v0.2.3
func (NullStream) Produce(s WriteStream) error
Produce implements Producer for NullStream
type Output ¶
type Output int
Output is an output format
func DefaultOutput ¶ added in v0.2.4
func DefaultOutput() Output
DefaultOutput returns the default output from environment
func OutputFromString ¶
OutputFromString converts a string to Output
type Pipeline ¶ added in v0.2.0
type Pipeline struct {
// contains filtered or unexported fields
}
Pipeline is the endpoint of a value stream process
func MakePipeline ¶ added in v0.2.3
func MakePipeline(ctx context.Context, tasks ...StreamTask) (p *Pipeline)
MakePipeline builds and runs a pipeline
type Producer ¶ added in v0.2.3
type Producer interface {
Produce(s WriteStream) error
}
Producer generates values for a WriteStream
type ProducerFunc ¶ added in v0.2.3
type ProducerFunc func(s WriteStream) error
ProducerFunc is a Producer callback
func ReadFromFile ¶ added in v0.2.3
func ReadFromFile(path string, format Format) ProducerFunc
ReadFromFile creates a StreamTask to read values from a file
func ReadFromTask ¶ added in v0.2.0
func ReadFromTask(r io.Reader, format Format) ProducerFunc
ReadFromTask creates a StreamTask to read values from a Reader
func (ProducerFunc) Produce ¶ added in v0.2.3
func (f ProducerFunc) Produce(s WriteStream) error
Produce implements Producer for ProducerFunc
func (ProducerFunc) Run ¶ added in v0.2.3
func (f ProducerFunc) Run(s Stream) error
Run implements StreamTask for ProducerFunc
type Producers ¶ added in v0.2.3
type Producers []Producer
Producers is a sequence of Producers
func (Producers) Produce ¶ added in v0.2.3
func (tasks Producers) Produce(s WriteStream) error
Produce implements Producer for Producers
type RawValue ¶ added in v0.2.3
type RawValue string
RawValue is a JSON string
func NewRawValue ¶ added in v0.2.3
NewRawValue creates a new RawValue from any value
func RawValueArray ¶ added in v0.2.3
RawValueArray joins RawValues to an array
func (RawValue) MarshalJSON ¶ added in v0.2.3
MarshalJSON implements json.Marshaler for RawValue
func (RawValue) MarshalJSONString ¶ added in v0.2.4
func (RawValue) MarshalYAML ¶ added in v0.2.3
MarshalYAML implements yaml.Marshaler for RawValue
func (*RawValue) UnmarshalJSON ¶ added in v0.2.3
UnmarshalJSON implements json.Unmarshaler for RawValue
func (*RawValue) UnmarshalYAML ¶ added in v0.2.3
UnmarshalYAML implements yaml.Unmarshaler for RawValue
type ReadStream ¶ added in v0.2.3
ReadStream is a readable stream of values
type Stream ¶ added in v0.2.0
type Stream interface {
ReadStream
WriteStream
}
Stream is a readable/writable stream of values
type StreamFunc ¶ added in v0.2.0
StreamFunc is a StreamTask callback
func (StreamFunc) Run ¶ added in v0.2.0
func (f StreamFunc) Run(s Stream) error
Run implements StreamTask for StramFunc
type StreamTask ¶ added in v0.2.0
StreamTask represents a task to run on a Stream
func ParseArgs ¶ added in v0.2.0
func ParseArgs(argv []string, stdin io.Reader, stdout io.WriteCloser) ([]StreamTask, bool, error)
ParseArgs builds a StreamTask sequence from arguments
type VarType ¶ added in v0.2.0
type VarType uint
VarType is the type of an external variable
const ( FileVar VarType CodeVar RawVar )
VarTypes
type WriteStream ¶ added in v0.2.3
WriteStream is a writtable stream of values