{"modulePath":"github.com/hyperhq/hyperd","version":"v1.1.0","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package engine\n\n## Functions\n\n```go\nfunc Tail(buffer *bytes.Buffer, n int) string\n```\nTail returns the n last lines of a buffer stripped out of trailing white spaces, if any.\n\nif n \\\u003c= 0, returns an empty string\n\n## Types\n\n```go\ntype Decoder struct {\n\t*json.Decoder\n}\n```\n\n```go\nfunc NewDecoder(src io.Reader) *Decoder\n```\n\n```go\nfunc (decoder *Decoder) Decode() (*Env, error)\n```\n\n```go\ntype Env []string\n```\n\n```go\nfunc (env *Env) Decode(src io.Reader) error\n```\nDecodeEnv decodes \\`src\\` as a json dictionary, and adds each decoded key-value pair to the environment.\n\nIf \\`src\\` cannot be decoded as a json dictionary, an error is returned.\n\n```go\nfunc (env *Env) Encode(dst io.Writer) error\n```\n\n```go\nfunc (env *Env) Exists(key string) bool\n```\n\n```go\nfunc (env *Env) Get(key string) (value string)\n```\nGet returns the last value associated with the given key. If there are no values associated with the key, Get returns the empty string.\n\n```go\nfunc (env *Env) GetBool(key string) (value bool)\n```\n\n```go\nfunc (env *Env) GetInt(key string) int\n```\n\n```go\nfunc (env *Env) GetInt64(key string) int64\n```\n\n```go\nfunc (env *Env) GetJson(key string, iface interface{}) error\n```\n\n```go\nfunc (env *Env) GetList(key string) []string\n```\nReturns nil if key not found\n\n```go\nfunc (env *Env) GetSubEnv(key string) *Env\n```\n\n```go\nfunc (env *Env) GetTime(key string) (time.Time, error)\n```\n\n```go\nfunc (env *Env) Import(src interface{}) (err error)\n```\n\n```go\nfunc (env *Env) Init(src *Env)\n```\n\n```go\nfunc (env *Env) InitMultiMap(m map[string][]string)\n```\nInitMultiMap removes all values in env, then initializes new values from the contents of m.\n\n```go\nfunc (env *Env) Len() int\n```\nLen returns the number of keys in the environment. Note that len(env) might be different from env.Len(), because the same key might be set multiple times.\n\n```go\nfunc (env *Env) Map() map[string]string\n```\n\n```go\nfunc (env *Env) MultiMap() map[string][]string\n```\nMultiMap returns a representation of env as a map of string arrays, keyed by string. This is the same structure as http headers for example, which allow each key to have multiple values.\n\n```go\nfunc (env *Env) Set(key, value string)\n```\n\n```go\nfunc (env *Env) SetAuto(k string, v interface{})\n```\n\n```go\nfunc (env *Env) SetBool(key string, value bool)\n```\n\n```go\nfunc (env *Env) SetInt(key string, value int)\n```\n\n```go\nfunc (env *Env) SetInt64(key string, value int64)\n```\n\n```go\nfunc (env *Env) SetJson(key string, value interface{}) error\n```\n\n```go\nfunc (env *Env) SetList(key string, value []string) error\n```\n\n```go\nfunc (env *Env) SetSubEnv(key string, sub *Env) error\n```\n\n```go\nfunc (env *Env) SetTime(key string, t time.Time)\n```\n\n```go\nfunc (env *Env) WriteJSON(w http.ResponseWriter, code int) error\n```\n\n```go\nfunc (env *Env) WriteTo(dst io.Writer) (int64, error)\n```\n\n```go\ntype Input struct {\n\tsync.Mutex\n\t// contains filtered or unexported fields\n}\n```\n\n```go\nfunc NewInput() *Input\n```\nNewInput returns a new Input object with no source attached. Reading to an empty Input will return io.EOF.\n\n```go\nfunc (i *Input) Add(src io.Reader) error\n```\nAdd attaches a new source to the input. Add can only be called once per input. Subsequent calls will return an error.\n\n```go\nfunc (i *Input) Close() error\n```\nCloses the src Not thread safe on purpose\n\n```go\nfunc (i *Input) Read(p []byte) (n int, err error)\n```\nRead reads from the input in a thread-safe way.\n\n```go\ntype Output struct {\n\tsync.Mutex\n\t// contains filtered or unexported fields\n}\n```\n\n```go\nfunc NewOutput() *Output\n```\nNewOutput returns a new Output object with no destinations attached. Writing to an empty Output will cause the written data to be discarded.\n\n```go\nfunc (o *Output) Add(dst io.Writer)\n```\nAdd attaches a new destination to the Output. Any data subsequently written to the output will be written to the new destination in addition to all the others. This method is thread-safe.\n\n```go\nfunc (o *Output) AddEnv() (dst *Env, err error)\n```\nAddEnv starts a new goroutine which will decode all subsequent data as a stream of json-encoded objects, and point \\`dst\\` to the last decoded object. The result \\`env\\` can be queried using the type-neutral Env interface. It is not safe to query \\`env\\` until the Output is closed.\n\n```go\nfunc (o *Output) AddListTable() (dst *Table, err error)\n```\n\n```go\nfunc (o *Output) AddPipe() (io.Reader, error)\n```\nAddPipe creates an in-memory pipe with io.Pipe(), adds its writing end as a destination, and returns its reading end for consumption by the caller. This is a rough equivalent similar to Cmd.StdoutPipe() in the standard os/exec package. This method is thread-safe.\n\n```go\nfunc (o *Output) AddTable() (dst *Table, err error)\n```\n\n```go\nfunc (o *Output) Close() error\n```\nClose unregisters all destinations and waits for all background AddTail and AddString tasks to complete. The Close method of each destination is called if it exists.\n\n```go\nfunc (o *Output) Set(dst io.Writer)\n```\nSet closes and remove existing destination and then attaches a new destination to the Output. Any data subsequently written to the output will be written to the new destination in addition to all the others. This method is thread-safe.\n\n```go\nfunc (o *Output) Used() bool\n```\nReturn true if something was written on this output\n\n```go\nfunc (o *Output) Write(p []byte) (n int, err error)\n```\nWrite writes the same data to all registered destinations. This method is thread-safe.\n\n```go\ntype Table struct {\n\tData []*Env\n\n\tChan chan *Env\n\t// contains filtered or unexported fields\n}\n```\n\n```go\nfunc NewTable(sortKey string, sizeHint int) *Table\n```\n\n```go\nfunc (t *Table) Add(env *Env)\n```\n\n```go\nfunc (t *Table) Len() int\n```\n\n```go\nfunc (t *Table) Less(a, b int) bool\n```\n\n```go\nfunc (t *Table) ReadFrom(src io.Reader) (n int64, err error)\n```\n\n```go\nfunc (t *Table) ReadListFrom(src []byte) (n int64, err error)\n```\n\n```go\nfunc (t *Table) ReverseSort()\n```\n\n```go\nfunc (t *Table) SetKey(sortKey string)\n```\n\n```go\nfunc (t *Table) Sort()\n```\n\n```go\nfunc (t *Table) Swap(a, b int)\n```\n\n```go\nfunc (t *Table) ToListString() (string, error)\n```\n\n```go\nfunc (t *Table) WriteListTo(dst io.Writer) (n int64, err error)\n```\n\n```go\nfunc (t *Table) WriteTo(dst io.Writer) (n int64, err error)\n```\n\n","path":"github.com/hyperhq/hyperd/engine","name":"engine","synopsis":"","isRedistributable":true}
