Documentation ¶
Overview ¶
********************************************************************************** The MIT License (MIT)
Copyright (c) 2022 Sean Beard ¶
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. **********************************************************************************
********************************************************************************** The MIT License (MIT)
Copyright (c) 2022 Sean Beard ¶
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. **********************************************************************************
Index ¶
- type FileDataSource
- func (filesource *FileDataSource) DeleteBulk(documents []dataaccess.Document) (interface{}, error)
- func (filesource *FileDataSource) DeleteItem(attributename string, attributeValue interface{}) (interface{}, error)
- func (filesource *FileDataSource) Exists(document dataaccess.Document) (bool, error)
- func (filesource *FileDataSource) Get(query dataaccess.Query) ([]dataaccess.Document, error)
- func (filesource *FileDataSource) GetAll() ([]dataaccess.Document, error)
- func (filesource *FileDataSource) GetItem(attributeName string, attributeValue interface{}) (dataaccess.Document, error)
- func (filesource *FileDataSource) GetList(attributeName string, attributeValue interface{}) ([]dataaccess.Document, error)
- func (filesource *FileDataSource) SaveBulk(documents []dataaccess.Document) (interface{}, error)
- func (filesource *FileDataSource) SaveItem(document dataaccess.Document, allowUpdate bool) (interface{}, error)
- func (filesource *FileDataSource) SetUnmarshalFn(unmarshal dataaccess.UnmarshalFn)
- func (filesource *FileDataSource) UpdateBulk(documents []dataaccess.Document) (interface{}, error)
- func (filesource *FileDataSource) UpdateItem(document dataaccess.Document, replace bool) (interface{}, error)
- type FileDataSourceConfiguration
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FileDataSource ¶
type FileDataSource struct { Location string Directory string Name string Readonly bool // contains filtered or unexported fields }
FileDataSource is a struct the represents (and is a proxy for) a JSON or YAML file located on the local file system or a network location. The object implementes the Datasource interface
func NewFileDataSource ¶
func NewFileDataSource(dsConfig dataaccess.DataSourceConfiguration) (*FileDataSource, error)
NewFileDataSource creates and returns a reference to a new FileDatasource instance and configures it for use. If an error occurs a nil reference and error are returned
func (*FileDataSource) DeleteBulk ¶
func (filesource *FileDataSource) DeleteBulk(documents []dataaccess.Document) (interface{}, error)
DeleteBulk removes/deletes the passed in slice of documkents from the datastore and returns the slice of deleted objects. Otherwise an error is returned.
func (*FileDataSource) DeleteItem ¶
func (filesource *FileDataSource) DeleteItem(attributename string, attributeValue interface{}) (interface{}, error)
DeleteItem removes/deletes the passed in document from the datastore and returns the deleted object. Otherwise an error is returned.
func (*FileDataSource) Exists ¶
func (filesource *FileDataSource) Exists(document dataaccess.Document) (bool, error)
Exists simply checks if a document exists in the configured index and returns a boolean indicating whether the doc exists. Otherwise an error is returned.
func (*FileDataSource) Get ¶
func (filesource *FileDataSource) Get(query dataaccess.Query) ([]dataaccess.Document, error)
Get retrieves all of the records that are contained in the query parameter
func (*FileDataSource) GetAll ¶
func (filesource *FileDataSource) GetAll() ([]dataaccess.Document, error)
GetAll retrieves all records from the given document, index, etc... Otherwise an error is returned.
func (*FileDataSource) GetItem ¶
func (filesource *FileDataSource) GetItem(attributeName string, attributeValue interface{}) (dataaccess.Document, error)
GetItem executes a query to return a single item based on the attribue name and value. Otherwise an error is returned.
func (*FileDataSource) GetList ¶
func (filesource *FileDataSource) GetList(attributeName string, attributeValue interface{}) ([]dataaccess.Document, error)
GetList executes a query to return a list of Documents based on the attribute name and value. Otherwise an error is returned.
func (*FileDataSource) SaveBulk ¶
func (filesource *FileDataSource) SaveBulk(documents []dataaccess.Document) (interface{}, error)
SaveBulk saves the slice of documents passed and returns the list of document ids. Otherwise an error is returned.
func (*FileDataSource) SaveItem ¶
func (filesource *FileDataSource) SaveItem(document dataaccess.Document, allowUpdate bool) (interface{}, error)
SaveItem saves the passed in docuemnt and returns the object id. Otherwise an error is returned.
func (*FileDataSource) SetUnmarshalFn ¶
func (filesource *FileDataSource) SetUnmarshalFn(unmarshal dataaccess.UnmarshalFn)
SetUnmarshalFn sets the object specific logic to unmarshal the Elasticsearch objects to their respective object respresentation
func (*FileDataSource) UpdateBulk ¶
func (filesource *FileDataSource) UpdateBulk(documents []dataaccess.Document) (interface{}, error)
UpdateBulk updates the slice of documents passed in and returns a slice of document ids. Otherwise an error is returned.
func (*FileDataSource) UpdateItem ¶
func (filesource *FileDataSource) UpdateItem(document dataaccess.Document, replace bool) (interface{}, error)
UpdateItem updates the existing document passed and returns the document id. Otherwise an error is returned.
type FileDataSourceConfiguration ¶
type FileDataSourceConfiguration struct { EmptyDocument string `json:"emptydocument" yaml:"emptydocument" mapstructure:"emptydocument"` Readonly bool `json:"readonly" yaml:"readonly" mapstructure:"readonly"` }
FileDataSourceConfiguration holds all of the information needed to define an JSON file data source