Documentation ¶
Index ¶
- Constants
- Variables
- func Delete(context interface{}, db *db.DB, name string) error
- func GetNames(context interface{}, db *db.DB) ([]string, error)
- func Upsert(context interface{}, db *db.DB, scr Script) error
- type Script
- func GetAll(context interface{}, db *db.DB, tags []string) ([]Script, error)
- func GetByName(context interface{}, db *db.DB, name string) (Script, error)
- func GetByNames(context interface{}, db *db.DB, names []string) ([]Script, error)
- func GetLastHistoryByName(context interface{}, db *db.DB, name string) (Script, error)
Constants ¶
View Source
const ( Collection = "query_scripts" CollectionHistory = "query_scripts_history" )
Contains the name of Mongo collections.
Variables ¶
View Source
var (
ErrNotFound = errors.New("Script Not found")
)
Set of error variables.
Functions ¶
Types ¶
type Script ¶
type Script struct { Name string `bson:"name" json:"name" validate:"required,min=3"` // Unique name per Script document Commands []map[string]interface{} `bson:"commands" json:"commands"` // Commands to add to a query. }
Script contain pre and post commands to use per set or per query.
func GetByNames ¶
GetByNames retrieves the documents for the specified names.
func GetLastHistoryByName ¶
GetLastHistoryByName gets the last written Script within the history.
func (Script) PrepareForInsert ¶
func (scr Script) PrepareForInsert()
PrepareForInsert replaces the `$` to `_$` when found in the front of field names.
func (Script) PrepareForUse ¶
func (scr Script) PrepareForUse()
PrepareForUse replaces the `_$` to `$` when found in the front of field names.
Click to show internal directories.
Click to hide internal directories.