Documentation
¶
Overview ¶
Package util util consists of general utility functions and structures.
Copyright 2021 Michael Bungenstock ¶
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Package util util consists of general utility functions and structures.
Copyright 2021 Michael Bungenstock ¶
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Package util util consists of general utility functions and structures.
Copyright 2021 Michael Bungenstock ¶
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Package util util consists of general utility functions and structures.
Copyright 2021 Michael Bungenstock ¶
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Package util util consists of general utility functions and structures.
Copyright 2021 Michael Bungenstock ¶
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Package util util consists of general utility functions and structures.
Copyright 2021 Michael Bungenstock ¶
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Package util util consists of general utility functions and structures.
Copyright 2021 Michael Bungenstock ¶
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Package util util consists of general utility functions and structures.
This code is taken from file encoding/json/encoding.go (1.15.8) and has been modified.
Copyright 2010 The Go Authors. All rights reserved. Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
Package util util consists of general utility functions and structures.
Copyright 2021 Michael Bungenstock ¶
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Package util util consists of general utility functions and structures.
Copyright 2021 Michael Bungenstock ¶
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Package util util consists of general utility functions and structures.
Copyright 2021 Michael Bungenstock ¶
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Package util util consists of general utility functions and structures.
Copyright 2021 Michael Bungenstock ¶
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Package util util consists of general utility functions and structures.
Copyright 2021 Michael Bungenstock ¶
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Package util util consists of general utility functions and structures.
Copyright 2021 Michael Bungenstock ¶
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Package util util consists of general utility functions and structures.
Copyright 2021 Michael Bungenstock ¶
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Package util util consists of general utility functions and structures.
Copyright 2021 Michael Bungenstock ¶
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Package util util consists of general utility functions and structures.
Copyright 2021 Michael Bungenstock ¶
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Package util util consists of general utility functions and structures.
Copyright 2021 Michael Bungenstock ¶
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Package util util consists of general utility functions and structures.
Copyright 2021 Michael Bungenstock ¶
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Package util util consists of general utility functions and structures.
Copyright 2021 Michael Bungenstock ¶
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Package util util consists of general utility functions and structures.
Copyright 2021 Michael Bungenstock ¶
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Package util util consists of general utility functions and structures.
Copyright 2021 Michael Bungenstock ¶
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Package util util consists of general utility functions and structures.
Copyright 2021 Michael Bungenstock ¶
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Package util util consists of general utility functions and structures.
Copyright 2021 Michael Bungenstock ¶
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Package util util consists of general utility functions and structures.
Copyright 2021 Michael Bungenstock ¶
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Index ¶
- Constants
- func AddDollar(s string) string
- func ByteCountIEC(b int64) string
- func ByteCountSI(b int64) string
- func Comma(ar ...string) string
- func Concat(sep string, ar ...string) string
- func ConsoleWidth() (int, error)
- func Contains(value string, ar []string) bool
- func ContainsS(value string, ar []string) string
- func Dashed(str string) string
- func Difference(a, b []string) []string
- func Example(s string) string
- func Form(s string) string
- func GetInt(value interface{}) (result int)
- func GetString(value interface{}) (result string)
- func HasPipe() bool
- func IsNumeric(value string) bool
- func JSONFloat(f float64, bits int) string
- func JSONPrintPretty(dec *json.Decoder, out io.Writer) error
- func JSONPrintPrettyln(dec *json.Decoder, out io.Writer) error
- func JSONString(s string) string
- func LineCount(str string) int
- func LoadPrivateKeyPEM(path string) (*rsa.PrivateKey, error)
- func LocalTimeStr(str string) string
- func LocalTimeStrCustom(str, fmt string) string
- func LongDesc(s string) string
- func NewJSONPathAttribute(name string) *jsonPathElement
- func NewJSONPathIndex(index int) *jsonPathElement
- func Paste() string
- func Plural(str string) string
- func RemoveQuotes(s string) string
- func StringOr(a, b string) string
- func Truncate(value string, max int) string
- type Claim
- type ConfigFile
- func (f *ConfigFile) ClientID() string
- func (f *ConfigFile) ClientSecret() string
- func (f *ConfigFile) Key() string
- func (f *ConfigFile) Organization() string
- func (f *ConfigFile) Query() *YAMLQuery
- func (f *ConfigFile) Sandbox() string
- func (f *ConfigFile) Save() error
- func (f *ConfigFile) SetClientID(id string)
- func (f *ConfigFile) SetClientSecret(secret string)
- func (f *ConfigFile) SetKey(key string)
- func (f *ConfigFile) SetOrganization(org string)
- func (f *ConfigFile) SetSandbox(sandbox string)
- func (f *ConfigFile) SetTechAccount(account string)
- func (f *ConfigFile) TechAccount() string
- type DescriptorRange
- type DescriptorVars
- type Dir
- func (d *Dir) Child(name string) (*Dir, error)
- func (d *Dir) ChildI(i int) (*Dir, error)
- func (d *Dir) HasParent() bool
- func (d *Dir) IsDir(i int) bool
- func (d *Dir) Parent() (*Dir, error)
- func (d *Dir) PathI(i int) string
- func (d *Dir) SortedByModTime(hidden, sep, asc bool) []os.FileInfo
- func (d *Dir) SortedByName(hidden, sep, asc bool) []os.FileInfo
- func (d *Dir) SortedBySize(hidden, sep, asc bool) []os.FileInfo
- type JSONCursor
- func (j *JSONCursor) Decode(v interface{}) error
- func (j *JSONCursor) End() error
- func (j *JSONCursor) More() bool
- func (j *JSONCursor) MoreTokens() bool
- func (j *JSONCursor) New() (*JSONCursor, error)
- func (j *JSONCursor) NextValue() (*Query, error)
- func (j *JSONCursor) NextValueF(filter []string) (*Query, error)
- func (j *JSONCursor) Offset() int64
- func (j *JSONCursor) PathInfo() (string, string)
- func (j *JSONCursor) PrintPretty() error
- func (j *JSONCursor) PrintRaw() error
- func (j *JSONCursor) Skip() error
- func (j *JSONCursor) Token() (json.Token, error)
- type JSONFile
- type JSONFinder
- type JSONIterator
- func (j *JSONIterator) Bool() (bool, error)
- func (j *JSONIterator) Cursor() *JSONCursor
- func (j *JSONIterator) Delim() (json.Delim, error)
- func (j *JSONIterator) Enter() error
- func (j *JSONIterator) EnterArray() error
- func (j *JSONIterator) EnterObject() error
- func (j *JSONIterator) Float() (float64, error)
- func (j *JSONIterator) Interface() (interface{}, error)
- func (j *JSONIterator) Leave() error
- func (j *JSONIterator) More() bool
- func (j *JSONIterator) Next() (*Query, error)
- func (j *JSONIterator) Offset() int64
- func (j *JSONIterator) Path(path ...string) error
- func (j *JSONIterator) PrintPretty() error
- func (j *JSONIterator) PrintRaw() error
- func (j *JSONIterator) Query() (*Query, error)
- func (j *JSONIterator) Range(f func(*Query) error) error
- func (j *JSONIterator) Skip() error
- func (j *JSONIterator) String() (string, error)
- func (j *JSONIterator) Token() (json.Token, error)
- type JSONMapIterator
- type JSONResponse
- type JSONValueIterator
- type LazyPath
- type Mapper
- type MultiFileReader
- type NVPTransformer
- type Path
- type PathProvider
- type Prefixes
- type Query
- func (q *Query) Array() []interface{}
- func (q *Query) Bool(path ...string) bool
- func (q *Query) Boolean() bool
- func (q *Query) Concat(separator string, rf func(*Query) string) string
- func (q *Query) Get(index int) *Query
- func (q *Query) Int(path ...string) int
- func (q *Query) Integer() int
- func (q *Query) Interface() interface{}
- func (q *Query) JSONFullPath() string
- func (q *Query) JSONName() string
- func (q *Query) JSONPath() string
- func (q *Query) Len(path ...string) int
- func (q *Query) Length() int
- func (q *Query) Nil() bool
- func (q *Query) Path(path ...string) *Query
- func (q *Query) Pretty() string
- func (q *Query) QueryArray() []*Query
- func (q *Query) Range(rf func(*Query))
- func (q *Query) RangeAttributes(rf func(string, *Query))
- func (q *Query) RangeAttributesE(rf func(string, *Query) error) error
- func (q *Query) RangeAttributesRich(rf func(name string, q *Query, index, size int))
- func (q *Query) RangeI(rf func(int, *Query))
- func (q *Query) RangeIE(rf func(int, *Query) error) error
- func (q *Query) RangeSortedAttributesRich(rf func(name string, q *Query, index, size int))
- func (q *Query) RangeSortedAttributesRichE(rf func(name string, q *Query, index, size int) error) error
- func (q *Query) RangeValues(rf func(*Query), exclude ...string)
- func (q *Query) RangeValuesE(rf func(*Query) error, exclude ...string) error
- func (q *Query) ResetPath() *Query
- func (q *Query) Str(path ...string) string
- func (q *Query) String() string
- func (q *Query) Strings() []string
- func (q *Query) Value(path ...string) interface{}
- type QueryDescription
- type RangePost
- type Restreamable
- type RootConfig
- type RowWriter
- type Scope
- type StackInt
- type TableColumnDescriptor
- type TableDescriptor
- func (t *TableDescriptor) AddMapping(name string, m Mapper)
- func (t *TableDescriptor) Header(wide bool) []string
- func (t *TableDescriptor) Iterator(c *JSONCursor) (JSONResponse, error)
- func (t *TableDescriptor) Preprocess(i JSONResponse) error
- func (t *TableDescriptor) WriteRow(q *Query, w *RowWriter, wide bool) error
- type TruncateWriter
- type YAMLQuery
- func (q *YAMLQuery) First() *YAMLQuery
- func (q *YAMLQuery) IsDocument() bool
- func (q *YAMLQuery) IsMap() bool
- func (q *YAMLQuery) IsNil() bool
- func (q *YAMLQuery) Path(path ...string) *YAMLQuery
- func (q *YAMLQuery) Set(value string)
- func (q *YAMLQuery) SetMap(key, value string)
- func (q *YAMLQuery) Str(path ...string) string
- func (q *YAMLQuery) String() string
Constants ¶
const ( JSONS_UNDEFINED jsonState = iota JSONS_OPEN JSONS_DONE JSONS_O // object attribute, expecting string or } JSONS_OV // object value, expecting {, [ VALUE or } JSONS_A // array value, expecting {, [ VALUE or ] JSONS_AV // close array value, required for simple values )
Variables ¶
This section is empty.
Functions ¶
func ByteCountIEC ¶ added in v0.1.1
ByteCountIEC returns the byte size in IEC units
func ByteCountSI ¶ added in v0.1.1
ByteCountSI returns the byte size in SI units
func ConsoleWidth ¶ added in v0.3.0
func Difference ¶
Difference substitues the array of strings b from a
func GetInt ¶
func GetInt(value interface{}) (result int)
GetInt returns the int value for the passed value or -1 for invalid input.
func GetString ¶
func GetString(value interface{}) (result string)
GetString accepts a value and tries to return a string representation. If a conversion is not possible, then this function returns an error.
func JSONPrintPretty ¶ added in v0.2.0
JSONPrintPretty streams the dec JSON content in an indented format to out
func JSONPrintPrettyln ¶ added in v0.3.1
func JSONString ¶ added in v0.2.0
JSONString encodes a string to JSON format
func LoadPrivateKeyPEM ¶
func LoadPrivateKeyPEM(path string) (*rsa.PrivateKey, error)
LoadPrivateKeyPEM reads the private key from the passed file in PEM format.
func LocalTimeStr ¶
LocalTimeStr converts time string in RFC3339 to local time in RFC822
func LocalTimeStrCustom ¶
LocalTimeStrCustom converts time string in RFC3339 to local time in custom format
func NewJSONPathAttribute ¶ added in v0.2.0
func NewJSONPathAttribute(name string) *jsonPathElement
func NewJSONPathIndex ¶ added in v0.2.0
func NewJSONPathIndex(index int) *jsonPathElement
func Paste ¶ added in v0.1.1
func Paste() string
Paste returns the textual content stored in the clipboard
func RemoveQuotes ¶
RemoveQuotes removes embracing quotes, e.g. "hello" becomes hello and 'world' becomes world
Types ¶
type Claim ¶
type Claim struct { Iss string // iss (issuer):identifies the principal that issued the JWT Sub string // sub (subject): identifies the principal that is the subject of the JWT Aud string // aud (audience): identifies the recipients that the JWT is intended for }
Claim contains the three regisitered claims required for authentication. See https://tools.ietf.org/html/rfc7519 for more details.
type ConfigFile ¶ added in v0.1.1
type ConfigFile struct { Node *yaml.Node Path string }
ConfigFile represents a configuration file in YAML format
func LoadConfigFile ¶ added in v0.1.1
func LoadConfigFile(cfg *RootConfig) (*ConfigFile, error)
LoadConfigFile loads the configuration file in YAML format for the passed path
func (*ConfigFile) ClientID ¶ added in v0.1.1
func (f *ConfigFile) ClientID() string
ClientID returns the current client id value
func (*ConfigFile) ClientSecret ¶ added in v0.1.1
func (f *ConfigFile) ClientSecret() string
ClientSecret returns the current client secret value
func (*ConfigFile) Key ¶ added in v0.1.1
func (f *ConfigFile) Key() string
Key returns the current private key path value
func (*ConfigFile) Organization ¶ added in v0.1.1
func (f *ConfigFile) Organization() string
Organization returns the current organization value
func (*ConfigFile) Query ¶ added in v0.1.1
func (f *ConfigFile) Query() *YAMLQuery
Query returns this configuraion as YAMLQuery
func (*ConfigFile) Sandbox ¶ added in v0.1.1
func (f *ConfigFile) Sandbox() string
Sandbox returns the current sandbox value
func (*ConfigFile) Save ¶ added in v0.1.1
func (f *ConfigFile) Save() error
Save saves the configuration in YAML format
func (*ConfigFile) SetClientID ¶ added in v0.1.1
func (f *ConfigFile) SetClientID(id string)
SetClientID sets the new client id value
func (*ConfigFile) SetClientSecret ¶ added in v0.1.1
func (f *ConfigFile) SetClientSecret(secret string)
SetClientSecret sets the new client secret value
func (*ConfigFile) SetKey ¶ added in v0.1.1
func (f *ConfigFile) SetKey(key string)
SetKey sets the new private key path value
func (*ConfigFile) SetOrganization ¶ added in v0.1.1
func (f *ConfigFile) SetOrganization(org string)
SetOrganization sets the new organization value
func (*ConfigFile) SetSandbox ¶ added in v0.1.1
func (f *ConfigFile) SetSandbox(sandbox string)
SetSandbox sets the new sandbox value
func (*ConfigFile) SetTechAccount ¶ added in v0.1.1
func (f *ConfigFile) SetTechAccount(account string)
SetTechAccount sets the new technical account value
func (*ConfigFile) TechAccount ¶ added in v0.1.1
func (f *ConfigFile) TechAccount() string
TechAccount returns the current technical account value
type DescriptorRange ¶ added in v0.2.0
type DescriptorRange struct { Vars []*DescriptorVars `json:"vars,omitempty" yaml:"vars,omitempty"` Columns []*TableColumnDescriptor `json:"columns,omitempty" yaml:"columns,omitempty"` Post *RangePost `json:"post,omitempty" yaml:"post,omitempty"` Type string `json:"type,omitempty" yaml:"type,omitempty"` Path []string `json:"path,omitempty" yaml:"path,omitempty"` }
DescriptorRange represents a range. Usually used to extract sub-values in multiple rows
type DescriptorVars ¶ added in v0.2.0
type DescriptorVars struct { Name string `json:"name,omitempty" yaml:"name,omitempty"` Type string `json:"type,omitempty" yaml:"type,omitempty"` Meta string `json:"meta,omitempty" yaml:"meta,omitempty"` Cast string `json:"cast,omitempty" yaml:"cast,omitempty"` Value string `json:"value,omitempty" yaml:"value,omitempty"` Path []string `json:"path,omitempty" yaml:"path,omitempty"` }
DescriptorVars represents a variable
type Dir ¶ added in v0.1.1
type Dir struct { Path string // contains filtered or unexported fields }
Dir helps to browse directories
func NewDirPath ¶ added in v0.1.1
NewDirPath creates an initialized Dir object for the passed path
func (*Dir) Parent ¶ added in v0.1.1
Parent returns the parent Dir object or nil if this Dir object is root
func (*Dir) SortedByModTime ¶ added in v0.1.1
SortedByModTime returns a list of FileInfo objects sorted by modification date
func (*Dir) SortedByName ¶ added in v0.1.1
SortedByName returns a list of FileInfo objects sorted by name
type JSONCursor ¶ added in v0.2.0
type JSONCursor struct {
// contains filtered or unexported fields
}
func NewJSONCursor ¶ added in v0.2.0
func NewJSONCursor(stream io.ReadCloser) *JSONCursor
func (*JSONCursor) Decode ¶ added in v0.2.0
func (j *JSONCursor) Decode(v interface{}) error
func (*JSONCursor) End ¶ added in v0.3.0
func (j *JSONCursor) End() error
func (*JSONCursor) More ¶ added in v0.2.0
func (j *JSONCursor) More() bool
func (*JSONCursor) MoreTokens ¶ added in v0.2.0
func (j *JSONCursor) MoreTokens() bool
func (*JSONCursor) New ¶ added in v0.3.0
func (j *JSONCursor) New() (*JSONCursor, error)
func (*JSONCursor) NextValue ¶ added in v0.2.0
func (j *JSONCursor) NextValue() (*Query, error)
func (*JSONCursor) NextValueF ¶ added in v0.2.0
func (j *JSONCursor) NextValueF(filter []string) (*Query, error)
func (*JSONCursor) Offset ¶ added in v0.2.0
func (j *JSONCursor) Offset() int64
func (*JSONCursor) PathInfo ¶ added in v0.2.0
func (j *JSONCursor) PathInfo() (string, string)
func (*JSONCursor) PrintPretty ¶ added in v0.2.0
func (j *JSONCursor) PrintPretty() error
PrintPretty prints the raw data with indention to standard out
func (*JSONCursor) PrintRaw ¶ added in v0.2.0
func (j *JSONCursor) PrintRaw() error
PrintRaw copies the raw data to standard out
func (*JSONCursor) Skip ¶ added in v0.2.0
func (j *JSONCursor) Skip() error
Skip skips the next element like for example a string, object or array
type JSONFile ¶ added in v0.2.0
type JSONFile struct {
// contains filtered or unexported fields
}
JSONFile stores json objects in a file
func NewJSONFile ¶ added in v0.2.0
NewJSONFile returns an initialzed JSONCache object
type JSONFinder ¶ added in v0.2.0
type JSONFinder struct {
// contains filtered or unexported fields
}
func NewJSONFinder ¶ added in v0.2.0
func NewJSONFinder() *JSONFinder
func (*JSONFinder) Add ¶ added in v0.2.0
func (j *JSONFinder) Add(f func(JSONResponse) error, path ...string)
func (*JSONFinder) Run ¶ added in v0.2.0
func (j *JSONFinder) Run() error
Path skips all element along the path
func (*JSONFinder) SetIterator ¶ added in v0.2.0
func (j *JSONFinder) SetIterator(i JSONResponse)
type JSONIterator ¶ added in v0.2.0
type JSONIterator struct {
// contains filtered or unexported fields
}
JSONIterator implements the JSONResponse interface
func NewJSONIterator ¶ added in v0.2.0
func NewJSONIterator(c *JSONCursor) *JSONIterator
func (*JSONIterator) Bool ¶ added in v0.2.0
func (j *JSONIterator) Bool() (bool, error)
Bool returns the boolean at the current position
func (*JSONIterator) Cursor ¶ added in v0.3.0
func (j *JSONIterator) Cursor() *JSONCursor
func (*JSONIterator) Delim ¶ added in v0.2.0
func (j *JSONIterator) Delim() (json.Delim, error)
Delim returns the delimiter like [,],{ or} at the current position
func (*JSONIterator) Enter ¶ added in v0.2.0
func (j *JSONIterator) Enter() error
Enter moves forward to the first element
func (*JSONIterator) EnterArray ¶ added in v0.2.0
func (j *JSONIterator) EnterArray() error
EnterArray moves forward to the first element in the array
func (*JSONIterator) EnterObject ¶ added in v0.2.0
func (j *JSONIterator) EnterObject() error
EnterObject moves forward to the first element in the object
func (*JSONIterator) Float ¶ added in v0.2.0
func (j *JSONIterator) Float() (float64, error)
Float returns the floating point number at the current position
func (*JSONIterator) Interface ¶ added in v0.2.0
func (j *JSONIterator) Interface() (interface{}, error)
Interface returns any element at the current position
func (*JSONIterator) Leave ¶ added in v0.2.0
func (j *JSONIterator) Leave() error
Enter moves forward to the first element
func (*JSONIterator) More ¶ added in v0.2.0
func (j *JSONIterator) More() bool
More checks if there is another element in the current object or array
func (*JSONIterator) Next ¶ added in v0.2.0
func (j *JSONIterator) Next() (*Query, error)
Next returns the next element
func (*JSONIterator) Offset ¶ added in v0.2.0
func (j *JSONIterator) Offset() int64
func (*JSONIterator) Path ¶ added in v0.2.0
func (j *JSONIterator) Path(path ...string) error
Path skips all element along the path
func (*JSONIterator) PrintPretty ¶ added in v0.2.0
func (j *JSONIterator) PrintPretty() error
PrintPretty prints the raw data with indention to standard out
func (*JSONIterator) PrintRaw ¶ added in v0.2.0
func (j *JSONIterator) PrintRaw() error
PrintRaw copies the raw data to standard out
func (*JSONIterator) Query ¶ added in v0.2.0
func (j *JSONIterator) Query() (*Query, error)
func (*JSONIterator) Range ¶ added in v0.2.0
func (j *JSONIterator) Range(f func(*Query) error) error
Range iterates over all elements of the current JSON object or array and calls the passed function
func (*JSONIterator) Skip ¶ added in v0.2.0
func (j *JSONIterator) Skip() error
Skip skips the next element like for example a string, object or array
func (*JSONIterator) String ¶ added in v0.2.0
func (j *JSONIterator) String() (string, error)
String returns the string at the current position
type JSONMapIterator ¶ added in v0.2.0
type JSONMapIterator struct {
*JSONIterator
}
JSONMapIterator is a specialized JSONIterator. It returns the attribute name and content in an array. Use it to iterate JSON objects.
func NewJSONMapIterator ¶ added in v0.2.0
func NewJSONMapIterator(c *JSONCursor) *JSONMapIterator
NewJSONMapIterator creates an initialized JSONMapIterator
func (*JSONMapIterator) Next ¶ added in v0.2.0
func (j *JSONMapIterator) Next() (*Query, error)
Next returns the name and the content of the current attribute.
type JSONResponse ¶ added in v0.2.0
type JSONResponse interface { //Close() error //Delim() (json.Delim, error) Enter() error //EnterArray() error EnterObject() error //Leave() error More() bool Next() (*Query, error) //Obj() (map[string]interface{}, error) Offset() int64 Path(...string) error PrintRaw() error PrintPretty() error Query() (*Query, error) //Range(func(*Query) error) error Skip() error Token() (json.Token, error) Cursor() *JSONCursor }
JSONResponse is the interface for streaming JSON objects TODO remove this interface
type JSONValueIterator ¶ added in v0.2.0
type JSONValueIterator struct { *JSONIterator // contains filtered or unexported fields }
func NewJSONValueIterator ¶ added in v0.2.0
func NewJSONValueIterator(c *JSONCursor, filter []string) *JSONValueIterator
func (*JSONValueIterator) More ¶ added in v0.2.0
func (j *JSONValueIterator) More() bool
func (*JSONValueIterator) Next ¶ added in v0.2.0
func (j *JSONValueIterator) Next() (*Query, error)
type LazyPath ¶
type LazyPath struct {
// contains filtered or unexported fields
}
LazyPath generates a file path on demand
func NewLazyPath ¶
func NewLazyPath(pp PathProvider, path ...string) *LazyPath
NewLazyPath creates an initialzed LazyPath object
type Mapper ¶
Mapper is a map of strings
func (Mapper) GetL ¶
GetL normalizes the key to lower case before getting the value. If no value can be found the original key will be returned.
func (Mapper) Invert ¶
Invert creats a new mapper with inverted key value relation. Key -> Value becomes Value -> Key.
type MultiFileReader ¶ added in v0.3.1
func (*MultiFileReader) Read ¶ added in v0.3.1
func (m *MultiFileReader) Read() ([]byte, error)
type NVPTransformer ¶ added in v0.3.0
type NVPTransformer struct{}
NVPTransformer is a generic transformer to Name, Value and Path
func (*NVPTransformer) Header ¶ added in v0.3.0
func (*NVPTransformer) Header(wide bool) []string
func (*NVPTransformer) Iterator ¶ added in v0.3.0
func (*NVPTransformer) Iterator(c *JSONCursor) (JSONResponse, error)
Iterator returns a JSONValueIterator returning all values
func (*NVPTransformer) Preprocess ¶ added in v0.3.0
func (*NVPTransformer) Preprocess(i JSONResponse) error
Preprocess has nothing to do
type Path ¶ added in v0.2.0
type Path interface {
Path() string
}
Path is the interface for objects providing a file path
type PathProvider ¶ added in v0.2.0
PathProvider is the interface for objects providing dynamic file path concatenation
type Prefixes ¶ added in v0.2.0
type Prefixes struct {
// contains filtered or unexported fields
}
func NewPrefixes ¶ added in v0.2.0
func NewPrefixes() *Prefixes
func (*Prefixes) Add ¶ added in v0.2.0
func (p *Prefixes) Add(f func(JSONResponse) error, path ...string)
type Query ¶
type Query struct {
// contains filtered or unexported fields
}
Query supports queries on raw json objects
func UnmarshallQuery ¶ added in v0.1.1
UnmarshallQuery unmarshal JSON data and returns a Query object
func (*Query) Concat ¶
Concat calls the passed function on all children and concatenates the results separated by the passed separator.
func (*Query) Interface ¶
func (q *Query) Interface() interface{}
Interface returns the current object
func (*Query) JSONFullPath ¶ added in v0.2.0
func (*Query) Path ¶
Path queries nested objects, e.g. property a.b.c will be queried with Path("a","b","c")
func (*Query) QueryArray ¶ added in v0.2.0
Range executes the passed function on all children of the current object
func (*Query) RangeAttributes ¶
RangeAttributes executes the passed function on all children of the current object
func (*Query) RangeAttributesE ¶ added in v0.2.0
RangeAttributesE executes the passed function on all children of the current object
func (*Query) RangeAttributesRich ¶ added in v0.3.0
func (*Query) RangeI ¶
RangeI executes the passed function on all children of the current object. It provides the index of the object.
func (*Query) RangeIE ¶ added in v0.3.0
RangeIE executes the passed function on all children of the current object. It provides the index of the object.
func (*Query) RangeSortedAttributesRich ¶ added in v0.3.0
func (*Query) RangeSortedAttributesRichE ¶ added in v0.3.0
func (*Query) RangeValues ¶ added in v0.3.0
func (*Query) RangeValuesE ¶ added in v0.3.0
type QueryDescription ¶ added in v0.3.0
type QueryDescription struct { CMD string `json:"cmd,omitempty" yaml:"cmd,omitempty"` Parameters []interface{} `json:"parameters,omitempty" yaml:"parameters,omitempty"` Path []string `json:"path,omitempty" yaml:"path,omitempty"` Query *QueryDescription `json:"query,omitempty" yaml:"query,omitempty"` Func func(*Scope, *Query) *Query }
QueryDescription represents a query
func (*QueryDescription) Prepare ¶ added in v0.3.0
func (d *QueryDescription) Prepare() error
type RangePost ¶ added in v0.2.0
type RangePost struct {
Vars []*DescriptorVars `json:"vars,omitempty" yaml:"vars,omitempty"`
}
RangePost represents the post phase of a range, usually for variable update
type Restreamable ¶ added in v0.2.0
type Restreamable struct {
// contains filtered or unexported fields
}
func NewRestreamable ¶ added in v0.2.0
func NewRestreamable(r io.Reader) (*Restreamable, error)
func (*Restreamable) Reader ¶ added in v0.2.0
func (r *Restreamable) Reader() io.Reader
type RootConfig ¶ added in v0.2.0
type RootConfig struct { Name string Version string Config string Tenant string Home string Debug bool Human bool }
RootConfig contains the global configuration
func NewRootConfig ¶ added in v0.2.0
func NewRootConfig(name, version string, cmd *cobra.Command) *RootConfig
NewRootConfig returns an initilized configuration.
func (*RootConfig) Configure ¶ added in v0.2.0
func (o *RootConfig) Configure(cmd *cobra.Command) error
Configure loads the configuration file encoded in json or yaml.
func (*RootConfig) JoinPath ¶ added in v0.2.0
func (o *RootConfig) JoinPath(path ...string) string
type RowWriter ¶ added in v0.2.0
type RowWriter struct {
// contains filtered or unexported fields
}
RowWriter writes rows to a stream
func NewCSVWriter ¶ added in v0.2.0
NewCSVWriter creates an initialized RowWriter with commas as delimiter
func NewTableWriter ¶ added in v0.2.0
NewTableWriter creates an initialized RowWriter with tabs as delimiter
func (*RowWriter) AutoFlush ¶ added in v0.2.0
AutoFlush sets the limit for the automatic flush during writes
func (*RowWriter) Write ¶ added in v0.2.0
Write writes one row with mutliple lines and terminates it with a newline. v is a slice of columns separated by the delimiter, e.g. a tab.
func (*RowWriter) WriteSingle ¶ added in v0.3.0
Write writes one row and terminates it with a newline
type Scope ¶ added in v0.2.0
type Scope struct {
// contains filtered or unexported fields
}
Scope represents the current variable scope
type StackInt ¶ added in v0.2.0
type StackInt []int
StackInt is a simple int stack (lifo)
type TableColumnDescriptor ¶ added in v0.2.0
type TableColumnDescriptor struct { Name string `json:"name" yaml:"name"` Long string `json:"long" yaml:"long"` Type string `json:"type" yaml:"type"` Meta string `json:"meta,omitempty" yaml:"meta,omitempty"` Path []string `json:"path,omitempty" yaml:"path,omitempty"` AltPath []string `json:"altPath,omitempty" yaml:"altPath,omitempty"` Format string `json:"format,omitempty" yaml:"format,omitempty"` Parameters []string `json:"parameters,omitempty" yaml:"parameters,omitempty"` Var string `json:"var,omitempty" yaml:"var,omitempty"` Mode string `json:"mode,omitempty" yaml:"mode,omitempty"` Query *QueryDescription `json:"query,omitempty" yaml:"query,omitempty"` // contains filtered or unexported fields }
TableColumnDescriptor contains all information to extract a column value
type TableDescriptor ¶ added in v0.2.0
type TableDescriptor struct { Mappings map[string]Mapper `json:"mappings,omitempty" yaml:"mappings,omitempty"` Columns []*TableColumnDescriptor `json:"columns,omitempty" yaml:"columns,omitempty"` // Wide []*TableColumnDescriptor `json:"wide,omitempty" yaml:"wide,omitempty"` Path []string `json:"path,omitempty" yaml:"path,omitempty"` Select []string `json:"select,omitempty" yaml:"select,omitempty"` Iter string `json:"iterator,omitempty" yaml:"iterator,omitempty"` Filter []string `json:"filter,omitempty" yaml:"filter,omitempty"` Vars []*DescriptorVars `json:"vars,omitempty" yaml:"vars,omitempty"` Range *DescriptorRange `json:"range,omitempty" yaml:"range,omitempty"` // contains filtered or unexported fields }
TableDescriptor contains all information to transform a JSON object to a table
func NewTableDescriptor ¶ added in v0.2.0
func NewTableDescriptor(def string) (*TableDescriptor, error)
NewTableDescriptor creates an initialzed TableDescriptor. It accpets a definition encoded in YAML format.
func (*TableDescriptor) AddMapping ¶ added in v0.3.0
func (t *TableDescriptor) AddMapping(name string, m Mapper)
func (*TableDescriptor) Header ¶ added in v0.2.0
func (t *TableDescriptor) Header(wide bool) []string
Header extracts the table header
func (*TableDescriptor) Iterator ¶ added in v0.2.0
func (t *TableDescriptor) Iterator(c *JSONCursor) (JSONResponse, error)
Iterator selects the configured iterator for the passed JSON stream
func (*TableDescriptor) Preprocess ¶ added in v0.2.0
func (t *TableDescriptor) Preprocess(i JSONResponse) error
Preprocess goes down the path and enters the list or object
type TruncateWriter ¶ added in v0.3.0
type TruncateWriter struct {
// contains filtered or unexported fields
}
func NewTruncateWriter ¶ added in v0.3.0
func NewTruncateWriter(w io.Writer, max int) *TruncateWriter
type YAMLQuery ¶ added in v0.1.1
type YAMLQuery struct {
// contains filtered or unexported fields
}
YAMLQuery supports the querying and editing of YAML documents without loosing the formating
func NewYAMLQuery ¶ added in v0.1.1
func NewYAMLQuery(node *yaml.Node) *YAMLQuery
NewYAMLQuery creates an initialized YAMLQuery object
func (*YAMLQuery) First ¶ added in v0.1.1
First skips the document node if necessary and returns the first real object
func (*YAMLQuery) IsDocument ¶ added in v0.1.1
IsDocument returns true if this object is a document
func (*YAMLQuery) Path ¶ added in v0.1.1
Path queries the passed path. Each path element must match an entry in the current map, otherwise an empty object will be returned.
Source Files
¶
- configuration.go
- console.go
- crypto.go
- file.go
- file_reader.go
- json.go
- json_cursor.go
- json_encode.go
- json_file.go
- json_finder.go
- json_iterator.go
- json_values.go
- jwt.go
- lazy_path.go
- mapper.go
- nvp_transformer.go
- paste.go
- query.go
- stack.go
- stream.go
- string.go
- table_descriptor.go
- table_writer.go
- template.go
- text_renderer.go
- truncate_writer.go
- yaml_query.go