Documentation ¶
Overview ¶
copied from https://github.com/Tufin/asciitree; Apache 2
stack of strings
stack of integers
Index ¶
- Constants
- func CollectFiles(dir string) (files []string, err error)
- func FileSha256(filename string) (string, error)
- func ListFiles(dir string) error
- func Sha256(in io.Reader) (string, error)
- func WaitForConnectionAvailable(host string, port int, timeout time.Duration) bool
- type Intent
- type PathTrie
- func (trie *PathTrie) Delete(key string) bool
- func (trie *PathTrie) Fprint(w io.Writer, root bool, padding string)
- func (trie *PathTrie) Get(key string) *PathTrie
- func (trie *PathTrie) Put(key string, value interface{}) (*PathTrie, bool)
- func (trie *PathTrie) String() string
- func (trie *PathTrie) Walk(walker trie.WalkFunc) error
- func (trie *PathTrie) WalkPath(key string, wantRootValue bool, walker trie.WalkFunc) error
- type PathTrieConfig
- type StringSlice
- type StringStack
- type UInt32Stack
Constants ¶
const ( Regular boxType = iota Last AfterLast Between )
Variables ¶
This section is empty.
Functions ¶
func CollectFiles ¶
CollectFiles is a convenience function to gather files under a directory.
func FileSha256 ¶
FileSha256 computes the sha256 hash of a file
Types ¶
type Intent ¶
Intent represents an action for an attribute name or "value" optionally prefixed by a '+' or '-'. If the prefix is missing, the Intent is not negative.
func ParseIntent ¶
type PathTrie ¶
type PathTrie struct {
// contains filtered or unexported fields
}
PathTrie is a trie of string keys and interface{} values. Internal nodes have nil values so stored nil values cannot be distinguished and are excluded from walks. By default, PathTrie will segment keys by forward slashes with PathSegmenter (e.g. "/a/b/c" -> "/a", "/b", "/c"). A custom StringSegmenter may be used to customize how strings are segmented into nodes. A classic trie might segment keys by rune (i.e. unicode points).
func NewPathTrieWithConfig ¶
func NewPathTrieWithConfig(config *PathTrieConfig) *PathTrie
NewPathTrieWithConfig allocates and returns a new *PathTrie with the given *PathTrieConfig
func (*PathTrie) Delete ¶
Delete removes the value associated with the given key. Returns true if a node was found for the given key. If the node or any of its ancestors becomes childless as a result, it is removed from the trie.
func (*PathTrie) Get ¶
Get returns the value stored at the given key. Returns nil for internal nodes or for nodes with a value of nil.
func (*PathTrie) Put ¶
Put inserts the value into the trie at the given key, replacing any existing items. It returns true if the put adds a new value, false if it replaces an existing value. Note that internal nodes have nil values so a stored nil value will not be distinguishable and will not be included in Walks.
func (*PathTrie) Walk ¶
Walk iterates over each key/value stored in the trie and calls the given walker function with the key and value. If the walker function returns an error, the walk is aborted. The traversal is depth first with no guaranteed order.
type PathTrieConfig ¶
type PathTrieConfig struct { Segmenter trie.StringSegmenter Separator string }
PathTrieConfig for building a path trie with different segmenter
type StringSlice ¶
type StringSlice []string
func (*StringSlice) Set ¶
func (i *StringSlice) Set(value string) error
Set implements the flag.Value interface.
func (*StringSlice) String ¶
func (i *StringSlice) String() string
type StringStack ¶
type StringStack []string
func (*StringStack) IsEmpty ¶
func (s *StringStack) IsEmpty() bool
IsEmpty checks if the stack is empty
func (*StringStack) Peek ¶
func (s *StringStack) Peek() (string, bool)
Peek: return top element of stack, return false if stack is empty
func (*StringStack) Pop ¶
func (s *StringStack) Pop() (string, bool)
Pop: remove and return top element of stack, return false if stack is empty
type UInt32Stack ¶
type UInt32Stack []uint32
func (*UInt32Stack) IsEmpty ¶
func (s *UInt32Stack) IsEmpty() bool
IsEmpty checks if the stack is empty
func (*UInt32Stack) Peek ¶
func (s *UInt32Stack) Peek() (uint32, bool)
Peek: return top element of stack, return false if stack is empty
func (*UInt32Stack) Pop ¶
func (s *UInt32Stack) Pop() (uint32, bool)
Pop: remove and return top element of stack, return false if stack is empty