Documentation
¶
Index ¶
- type AssertData
- func (a *AssertData) Clear()
- func (a *AssertData) GetArray() ([]string, error)
- func (a *AssertData) GetError() error
- func (a *AssertData) GetInt() (int, error)
- func (a *AssertData) GetMap() (map[string]string, error)
- func (a *AssertData) GetString() (string, error)
- func (a *AssertData) Index(i int) *AssertData
- func (a *AssertData) Input(o interface{}) *AssertData
- func (a *AssertData) Key(k string) *AssertData
- type SQL
- type Storage
- func (s *Storage) AddDoc() error
- func (c Storage) Clear()
- func (c Storage) ClearLib()
- func (s *Storage) Close() error
- func (s *Storage) Delete(k string) error
- func (s *Storage) DeleteAll(delete bool) *Storage
- func (c Storage) DeleteAllData()
- func (c Storage) DeleteBuffer()
- func (c Storage) DeleteData(i int) error
- func (s *Storage) DeleteDoc(i int) error
- func (s *Storage) DeleteGlobal(k string) error
- func (s *Storage) FindKeys(k string) ([]string, error)
- func (s *Storage) FindKeysGlobal(k string) map[int][]string
- func (s *Storage) Get(k string) ([]string, error)
- func (c Storage) GetAD() int
- func (c Storage) GetAllBuffer() []*interface{}
- func (c Storage) GetAllData() []interface{}
- func (c Storage) GetBufferFromIndex(i int) (*interface{}, error)
- func (c Storage) GetData() interface{}
- func (c Storage) GetDataFromIndex(i int) (interface{}, error)
- func (s *Storage) GetFirst(k string) (interface{}, error)
- func (s *Storage) GetFirstGlobal(k string) map[int]interface{}
- func (s *Storage) GetPath(k string) (interface{}, error)
- func (s *Storage) GetPathGlobal(k string) map[int]interface{}
- func (s *Storage) ImportDocs(path string, o ...bool) error
- func (s *Storage) InMem(m bool) *Storage
- func (c Storage) IndexInRange(i int) error
- func (c Storage) Lib() map[string]int
- func (c Storage) LibIndex(doc string) (int, bool)
- func (s *Storage) ListDocs() []string
- func (s *Storage) MergeDBs(path string) error
- func (c Storage) PushBuffer(d interface{})
- func (c Storage) PushData(d interface{})
- func (s *Storage) Read() error
- func (c Storage) RemoveDocName(i int) error
- func (c Storage) SetAD(i int) error
- func (c Storage) SetBufferFromIndex(v interface{}, i int) error
- func (c Storage) SetData(v interface{}) error
- func (c Storage) SetDataFromIndex(v interface{}, i int) error
- func (s *Storage) SetName(n string, i int) error
- func (s *Storage) SetNames(f, l string) error
- func (s *Storage) Switch(i int) error
- func (s *Storage) SwitchDoc(n string) error
- func (c Storage) UnsetBufferArray()
- func (c Storage) UnsetDataArray()
- func (s *Storage) UpdateGlobal(k string, i interface{}) error
- func (s *Storage) Upsert(k string, i interface{}) error
- func (s *Storage) UpsertGlobal(k string, i interface{}) error
- func (s *Storage) Write() error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AssertData ¶ added in v0.0.9
type AssertData struct {
// contains filtered or unexported fields
}
AssertData is used to for converting interface objects to map of interfaces or array of interfaces
func NewConvertFactory ¶ added in v0.0.9
func NewConvertFactory() *AssertData
NewConvertFactory for initializing AssertData
func (*AssertData) Clear ¶ added in v0.0.9
func (a *AssertData) Clear()
Clear for resetting AssertData
func (*AssertData) GetArray ¶ added in v0.0.9
func (a *AssertData) GetArray() ([]string, error)
GetArray for converting a []interface{} to []string
func (*AssertData) GetError ¶ added in v0.1.1
func (a *AssertData) GetError() error
GetError returns the any error set to AssertData
func (*AssertData) GetInt ¶ added in v0.1.1
func (a *AssertData) GetInt() (int, error)
GetInt asserts the input as int
func (*AssertData) GetMap ¶ added in v0.0.9
func (a *AssertData) GetMap() (map[string]string, error)
GetMap for converting a map[interface{}]interface{} into a map[string]string
func (*AssertData) GetString ¶ added in v0.1.1
func (a *AssertData) GetString() (string, error)
GetString asserts the input as string
func (*AssertData) Index ¶ added in v0.0.9
func (a *AssertData) Index(i int) *AssertData
Index getting an interface{} from a []interface{}
func (*AssertData) Input ¶ added in v0.0.9
func (a *AssertData) Input(o interface{}) *AssertData
Input sets a data source that can be used for assertion
func (*AssertData) Key ¶ added in v0.0.9
func (a *AssertData) Key(k string) *AssertData
Key copies initial interface object and returns a map of interfaces{} Used to easily pipe interfaces
type SQL ¶
SQL is the core struct for working with maps.
func NewSQLFactory ¶ added in v0.0.5
func NewSQLFactory() *SQL
NewSQLFactory creates a new empty SQL
type Storage ¶
Storage is the main object exported by DBy. It consolidates together the Yaml Data and SQL
func NewStorageFactory ¶
NewStorageFactory for creating a new Storage
func (*Storage) AddDoc ¶ added in v0.1.0
AddDoc will add a new document to the stack and will switch Active Document index to that document
func (Storage) ClearLib ¶ added in v0.3.3
func (c Storage) ClearLib()
ClearLib removes all keys from the lib map
func (*Storage) Close ¶ added in v0.3.3
Close method will do a write if InMem is false and then clear cache and buffers
func (*Storage) Delete ¶
Delete is a SQL wrapper that deletes the last key from a given path. For example, Delete("key-1.key-2.key-3") would first validate that the path exists, then it would export the value of GetPath("key-1.key-2") and delete the object that matches key-3
func (Storage) DeleteAllData ¶ added in v0.3.3
func (c Storage) DeleteAllData()
DeleteAllData calls PurgeAllData first and then creates a new empty array
func (Storage) DeleteBuffer ¶ added in v0.3.3
func (c Storage) DeleteBuffer()
DeleteBuffer deletes the data from the buffer array
func (Storage) DeleteData ¶ added in v0.3.3
DeleteData for deleting the i'th element from the data array
func (*Storage) DeleteGlobal ¶ added in v0.2.1
DeleteGlobal is the same as Delete but will try to delete the path on all docs (if found)
func (*Storage) FindKeys ¶ added in v0.1.0
FindKeys is a SQL wrapper that finds all the paths for a given e.g. ["key-1.test", "key-2.key-3.test"] will be returned
func (*Storage) FindKeysGlobal ¶ added in v0.2.0
FindKeysGlobal does the same as FindKeys but for all docs. Instead of returning a list of keys it returns a map with indexes from the docs and value an array of paths that was found
func (*Storage) Get ¶
Get is alias of FindKeys. This function will be replaced by FindKeys in the future. For now we keep both for compatibility
func (Storage) GetAD ¶ added in v0.3.3
func (c Storage) GetAD() int
GetAD returns the current active document index
func (Storage) GetAllBuffer ¶ added in v0.3.3
func (c Storage) GetAllBuffer() []*interface{}
GetAllBuffer returns the buffer array
func (Storage) GetAllData ¶ added in v0.3.3
func (c Storage) GetAllData() []interface{}
GetAllData returns the data array
func (Storage) GetBufferFromIndex ¶ added in v0.3.3
GetBufferFromIndex returns the i'th element from the buffer array
func (Storage) GetData ¶ added in v0.3.3
func (c Storage) GetData() interface{}
GetData returns the data in the c.ad index from the data array
func (Storage) GetDataFromIndex ¶ added in v0.3.3
GetDataFromIndex returns the i'th element from the data array
func (*Storage) GetFirst ¶
GetFirst is a SQL wrapper for finding the first key in the yaml hierarchy. If two keys are on the same level but under different paths, then the selection will be random
func (*Storage) GetFirstGlobal ¶ added in v0.2.0
GetFirstGlobal does the same as GetFirst but for all docs. Instead of returning an interface it returns a map with keys the index of the doc that a key was found and value the value of the key
func (*Storage) GetPath ¶
GetPath is a SQL wrapper that returns the value for a given path. Example, it would return "value-1" if "key-1.key-2" was the path asked from the following yaml --------- key-1:
key-2: value-1
func (*Storage) GetPathGlobal ¶ added in v0.2.1
GetPathGlobal does the same as GetPath but globally for all docs
func (*Storage) ImportDocs ¶ added in v0.1.0
ImportDocs for importing documents
func (Storage) IndexInRange ¶ added in v0.3.3
IndexInRange check if index is within data array range
func (*Storage) MergeDBs ¶
MergeDBs is a SQL wrapper that merges a source yaml file with the DBy local yaml file.
func (Storage) PushBuffer ¶ added in v0.3.3
func (c Storage) PushBuffer(d interface{})
PushBuffer for appending data to the buffer array
func (Storage) PushData ¶ added in v0.3.3
func (c Storage) PushData(d interface{})
PushData for appending data to the data array
func (Storage) RemoveDocName ¶ added in v0.3.3
RemoveDocName removes a doc from the lib
func (Storage) SetBufferFromIndex ¶ added in v0.3.3
SetDataFromIndex sets to input value the i'th element from the data array
func (Storage) SetData ¶ added in v0.3.3
func (c Storage) SetData(v interface{}) error
SetData sets to input value the data in the c.ad index from the data array
func (Storage) SetDataFromIndex ¶ added in v0.3.3
SetDataFromIndex sets to input value the i'th element from the data array
func (*Storage) SetName ¶ added in v0.1.0
SetName adds a name for a document and maps with it the given doc index
func (*Storage) SetNames ¶ added in v0.1.0
SetNames can set names automatically to the documents that have the queried paths. input(f) is the first path that will be quieried input(l) is the last path
If a document has both paths, a name will be generated and will be mapped with the document's index
func (*Storage) SwitchDoc ¶ added in v0.1.0
SwitchDoc for switching to a document using the documents name (if any)
func (Storage) UnsetBufferArray ¶ added in v0.3.3
func (c Storage) UnsetBufferArray()
UnsetBufferArray This sets buffer = nil
func (Storage) UnsetDataArray ¶ added in v0.3.3
func (c Storage) UnsetDataArray()
UnsetDataArray for deleting all data. This sets data = nil
func (*Storage) UpdateGlobal ¶ added in v0.1.0
UpdateGlobal is a SQL wrapper for adding/updating map structures in all documents. This will change all existing paths to the given structure (if any)
func (*Storage) UpsertGlobal ¶ added in v0.1.0
UpsertGlobal is a SQL wrapper for adding/updating map structures in all documents. This will change all existing paths to the given structure and add new if the path is missing for a document