util

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2021 License: Apache-2.0 Imports: 27 Imported by: 0

Documentation

Overview

Package util util consists of general utility functions and structures.

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.

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.

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.

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.

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.

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.

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.

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.

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.

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.

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.

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.

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.

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.

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.

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.

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

This section is empty.

Variables

This section is empty.

Functions

func AddDollar

func AddDollar(s string) string

AddDollar prepends a dollar sign to the string if it

func ByteCountIEC added in v0.1.1

func ByteCountIEC(b int64) string

ByteCountIEC returns the byte size in IEC units

func ByteCountSI added in v0.1.1

func ByteCountSI(b int64) string

ByteCountSI returns the byte size in SI units

func Contains

func Contains(value string, ar []string) bool

Contains checks for the existence of the passed value in the array

func ContainsS

func ContainsS(value string, ar []string) string

ContainsS checks for the existence of the passed value in the array

func Dashed

func Dashed(str string) string

Dashed returns the string "-" if passed string is empty.

func Difference

func Difference(a, b []string) []string

Difference substitues the array of strings b from a

func Example

func Example(s string) string

Example normalizes the example section

func Form added in v0.1.1

func Form(s string) string

Form normalizes the form text

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 LineCount added in v0.1.1

func LineCount(str string) int

LineCount returns the number of lines

func LoadPrivateKeyPEM

func LoadPrivateKeyPEM(path string) (*rsa.PrivateKey, error)

LoadPrivateKeyPEM reads the private key from the passed file in PEM format.

func LocalTimeStr

func LocalTimeStr(str string) string

LocalTimeStr converts time string in RFC3339 to local time in RFC822

func LocalTimeStrCustom

func LocalTimeStrCustom(str, fmt string) string

LocalTimeStrCustom converts time string in RFC3339 to local time in custom format

func LongDesc

func LongDesc(s string) string

LongDesc normalizes the long description

func Par

func Par(pairs ...string) string

Par takes a list of name value pairs and builds a url parameter list

func Paste added in v0.1.1

func Paste() string

Paste returns the textual content stored in the clipboard

func Plural

func Plural(str string) string

Plural generates the English plural of the passed string

func RemoveQuotes

func RemoveQuotes(s string) string

RemoveQuotes removes embracing quotes, e.g. "hello" becomes hello and 'world' becomes world

func StringOr added in v0.1.1

func StringOr(a, b string) string

StringOr returns the first string if it is not empty, otherwise the last one

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.

func (*Claim) JWT

func (claim *Claim) JWT(key *rsa.PrivateKey) (string, error)

JWT calculates the signature of the claim and returns the JSON Web Token.

type Column

type Column struct {
	Number int
	Name   string
	Cells  []interface{}
	Calc   func(interface{}) interface{}
}

Column represents one column in a table

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(path string) (*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 Dir added in v0.1.1

type Dir struct {
	Path string
	// contains filtered or unexported fields
}

Dir helps to browse directories

func NewDir added in v0.1.1

func NewDir() (*Dir, error)

NewDir creates an initialized Dir object for the current directory

func NewDirPath added in v0.1.1

func NewDirPath(dir string) (*Dir, error)

NewDirPath creates an initialized Dir object for the passed path

func (*Dir) Child added in v0.1.1

func (d *Dir) Child(name string) (*Dir, error)

Child returns the Dir object for the child with the passed name

func (*Dir) ChildI added in v0.1.1

func (d *Dir) ChildI(i int) (*Dir, error)

ChildI returns the Dir object of the ith child

func (*Dir) HasParent added in v0.1.1

func (d *Dir) HasParent() bool

HasParent returns true if this Dir object is not root

func (*Dir) IsDir added in v0.1.1

func (d *Dir) IsDir(i int) bool

IsDir returns true if the ith child is a directory

func (*Dir) Parent added in v0.1.1

func (d *Dir) Parent() (*Dir, error)

Parent returns the parent Dir object or nil if this Dir object is root

func (*Dir) PathI added in v0.1.1

func (d *Dir) PathI(i int) string

PathI returns the full path for the ith child

func (*Dir) SortedByModTime added in v0.1.1

func (d *Dir) SortedByModTime(hidden, sep, asc bool) []os.FileInfo

SortedByModTime returns a list of FileInfo objects sorted by modification date

func (*Dir) SortedByName added in v0.1.1

func (d *Dir) SortedByName(hidden, sep, asc bool) []os.FileInfo

SortedByName returns a list of FileInfo objects sorted by name

func (*Dir) SortedBySize added in v0.1.1

func (d *Dir) SortedBySize(hidden, sep, asc bool) []os.FileInfo

SortedBySize returns a list of FileInfo objects sorted by size

type GlobalConfig

type GlobalConfig struct {
	Name   string
	Config string
	Debug  bool
	Human  bool
}

GlobalConfig contains the global configuration

func NewGlobalConfig

func NewGlobalConfig(name string, cmd *cobra.Command) *GlobalConfig

NewGlobalConfig returns an initilized configuration.

func (*GlobalConfig) Configure

func (o *GlobalConfig) Configure(cmd *cobra.Command) error

Configure loads the configuration file encoded in json or yaml.

func (*GlobalConfig) GetPreRunE

func (o *GlobalConfig) GetPreRunE() func(*cobra.Command, []string) error

GetPreRunE returns the function for PreRunE function of cobra.Comamand

type JSONCache

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

JSONCache stores json objects in a file

func NewJSONCache

func NewJSONCache(path func() []string) *JSONCache

NewJSONCache returns an initialzed JSONCache object

func (*JSONCache) Invalidate

func (jc *JSONCache) Invalidate()

Invalidate invalidates the cache by deleting the related file

func (*JSONCache) Load

func (jc *JSONCache) Load(obj interface{}) error

Load loads the json file into the passed object

func (*JSONCache) Save

func (jc *JSONCache) Save(obj interface{}) error

Save stores the passed object in json format to a file

type KVCache

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

KVCache is a key value cache for strings with optional persistence

func NewKVCache

func NewKVCache(cacheRead, cacheWrite func() bool, exec func() (map[string]string, error), path func() []string) *KVCache

NewKVCache creates an initialized KVCache object

func (*KVCache) GetValue

func (l *KVCache) GetValue(key string) string

GetValue returns the value for the passed key. If no value could be retrieved then the key will be returned.

func (*KVCache) GetValueE

func (l *KVCache) GetValueE(key string) (string, error)

GetValueE returns the value for the passed key. If no value could be retrieved then an error will be returned.

func (*KVCache) Invalidate

func (l *KVCache) Invalidate()

Invalidate invalidates the cache

func (*KVCache) Keys

func (l *KVCache) Keys() ([]string, error)

Keys returns a list of keys

func (*KVCache) Load

func (l *KVCache) Load() (*KVCacheData, error)

Load loads the cache

func (*KVCache) MapValues

func (l *KVCache) MapValues(m func(string) string)

MapValues calls the passed function for each value and stores the result

func (*KVCache) Remove

func (l *KVCache) Remove(key string)

Remove removes the string with the passed key

func (*KVCache) Values

func (l *KVCache) Values() ([]string, error)

Values returns a list of values

type KVCacheData

type KVCacheData struct {
	Map     map[string]string
	Expires time.Time
}

KVCacheData stores the data of the KVCache with an expiry date

func (*KVCacheData) Get

func (c *KVCacheData) Get(key string) string

Get returns the value for the passed key. If no value could be found then the key will be returned.

func (*KVCacheData) GetE

func (c *KVCacheData) GetE(key string) (string, error)

GetE returns the value for the passed key. If no value could be found then an error will be returned.

func (*KVCacheData) Keys

func (c *KVCacheData) Keys() []string

Keys returns a list of keys

func (*KVCacheData) ValidIn

func (c *KVCacheData) ValidIn(d time.Duration) bool

ValidIn in checks if the token is still valid for passed duration

func (*KVCacheData) Values

func (c *KVCacheData) Values() []string

Values returns a list of values

type LazyPath

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

LazyPath builds a path on the first call

func NewLazyPath

func NewLazyPath(exec func() []string) *LazyPath

NewLazyPath returns an initialized LazyPath object

func (*LazyPath) Full

func (lp *LazyPath) Full() []string

Full returns the full path

func (*LazyPath) Name

func (lp *LazyPath) Name() string

Name returns the name of the file

func (*LazyPath) Path

func (lp *LazyPath) Path() []string

Path returns the path component

type Mapper

type Mapper map[string]string

Mapper is a map of strings

func (Mapper) Get

func (m Mapper) Get(key string) string

Get returns the value for the passed key. If no value can be found the key will be returned.

func (Mapper) GetL

func (m Mapper) GetL(key string) string

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

func (m Mapper) Invert() Mapper

Invert creats a new mapper with inverted key value relation. Key -> Value becomes Value -> Key.

func (Mapper) Keys

func (m Mapper) Keys() []string

Keys returns a list of keys

type ObjectCache

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

ObjectCache is an object cache

func NewObjectCache

func NewObjectCache(f func() ([]interface{}, error)) *ObjectCache

NewObjectCache creates an initialized ObjectCache object

func (*ObjectCache) Load

func (c *ObjectCache) Load() (*ObjectCacheData, error)

Load loads the cache

func (*ObjectCache) Mapper

func (c *ObjectCache) Mapper(key, value []string) Mapper

Mapper converts the stored objects to a Mapper. Parameters key and value are Query paths to the desired object attributes.

type ObjectCacheData

type ObjectCacheData struct {
	Map     []interface{}
	Expires time.Time
}

ObjectCacheData stores the objects

func (*ObjectCacheData) Valid

func (c *ObjectCacheData) Valid() bool

Valid in checks if the token is still valid for passed duration

type Query

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

Query supports queries on raw json objects

func NewQuery

func NewQuery(obj interface{}) *Query

NewQuery creates an initialized query object

func UnmarshallQuery added in v0.1.1

func UnmarshallQuery(data []byte) (*Query, error)

UnmarshallQuery unmarshal JSON data and returns a Query object

func (*Query) Concat

func (q *Query) Concat(separator string, rf func(*Query) string) string

Concat calls the passed function on all children and concatenates the results separated by the passed separator.

func (*Query) Get

func (q *Query) Get(index int) *Query

Get returns the children at the passed index

func (*Query) Int

func (q *Query) Int(path ...string) int

Int returns the integer of the referenced path

func (*Query) Interface

func (q *Query) Interface() interface{}

Interface returns the current object

func (*Query) Len

func (q *Query) Len(path ...string) int

Len returns the length of the referenced path

func (*Query) Length

func (q *Query) Length() int

Length returns the length of the current object

func (*Query) Path

func (q *Query) Path(path ...string) *Query

Path queries nested objects, e.g. property a.b.c will be queried with Path("a","b","c")

func (*Query) Range

func (q *Query) Range(rf func(*Query))

Range executes the passed function on all children of the current object

func (*Query) RangeAttributes

func (q *Query) RangeAttributes(rf func(string, *Query))

RangeAttributes executes the passed function on all children of the current object

func (*Query) RangeI

func (q *Query) RangeI(rf func(int, *Query))

RangeI executes the passed function on all children of the current object. It provides the index of the object.

func (*Query) Str

func (q *Query) Str(path ...string) string

Str returns the string of the referenced path

func (*Query) String

func (q *Query) String() string

String returns the current object as string

func (*Query) Strings

func (q *Query) Strings() []string

Strings returns the current object as array of strings

func (*Query) Value

func (q *Query) Value(path ...string) interface{}

Value returns the object of the referenced path

type StringCache

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

StringCache is a string cache

func NewStringCache

func NewStringCache(cacheRead, cacheWrite func() bool, exec func() ([]string, error), path func() []string) *StringCache

NewStringCache creates an initialized StringCache object

func (*StringCache) GetList

func (l *StringCache) GetList() ([]string, error)

GetList returns all stored values

func (*StringCache) Load

func (l *StringCache) Load() (*StringCacheData, error)

Load loads the cache

type StringCacheData

type StringCacheData struct {
	List    []string
	Expires time.Time
}

StringCacheData stores a list of strings with expiry date

func (*StringCacheData) ValidIn

func (c *StringCacheData) ValidIn(d time.Duration) bool

ValidIn in checks if the list is still valid for passed duration

type Table

type Table struct {
	Columns    []*Column
	Height     int
	Width      int
	HideHeader bool
	// contains filtered or unexported fields
}

Table contains any object represented as table

func NewTable

func NewTable(names []string, capacity int) *Table

NewTable creates a new initialized table with column names and initial capacity

func (*Table) Append

func (t *Table) Append(row map[string]interface{})

Append appends a new row to the end of the table

func (*Table) Array

func (t *Table) Array() [][]interface{}

Array converts the table to a two-dimensional array (row x column)

func (*Table) Column

func (t *Table) Column(name string) *Column

Column returns the column with the passed name

func (*Table) Get

func (t *Table) Get(row, col int) interface{}

Get returns the cell value for the passed coordinations

func (*Table) Print

func (t *Table) Print(out io.Writer)

Print prints the table to the passed io.Writer

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

func (q *YAMLQuery) First() *YAMLQuery

First skips the document node if necessary and returns the first real object

func (*YAMLQuery) IsDocument added in v0.1.1

func (q *YAMLQuery) IsDocument() bool

IsDocument returns true if this object is a document

func (*YAMLQuery) IsMap added in v0.1.1

func (q *YAMLQuery) IsMap() bool

IsMap returns true if this object is a map

func (*YAMLQuery) IsNil added in v0.1.1

func (q *YAMLQuery) IsNil() bool

IsNil tests if the current object is nil

func (*YAMLQuery) Path added in v0.1.1

func (q *YAMLQuery) Path(path ...string) *YAMLQuery

Path queries the passed path. Each path element must match an entry in the current map, otherwise an empty object will be returned.

func (*YAMLQuery) Set added in v0.1.1

func (q *YAMLQuery) Set(value string)

Set sets the value of the current object

func (*YAMLQuery) SetMap added in v0.1.1

func (q *YAMLQuery) SetMap(key, value string)

SetMap sets the key-value pair

func (*YAMLQuery) Str added in v0.1.1

func (q *YAMLQuery) Str(path ...string) string

Str returns the string of the referenced path

func (*YAMLQuery) String added in v0.1.1

func (q *YAMLQuery) String() string

String returns the current object as string

Jump to

Keyboard shortcuts

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