# README
regex
import "github.com/coralproject/shelf/internal/xenia/regex"
Overview
Package regex provides the service layer for building apps using regex functionality.
Index
- Constants
- Variables
- func Delete(context interface{}, db *db.DB, name string) error
- func GetAll(context interface{}, db *db.DB, tags []string) ([]Regex, error)
- func GetByNames(context interface{}, db *db.DB, names []string) ([]Regex, error)
- func GetNames(context interface{}, db *db.DB) ([]string, error)
- func Upsert(context interface{}, db *db.DB, rgx Regex) error
- type Regex
Package files
Constants
const (
Collection = "query_regexs"
CollectionHistory = "query_regexs_history"
)
Contains the name of Mongo collections.
Variables
var (
ErrNotFound = errors.New("Regex Not found")
)
Set of error variables.
func Delete
func Delete(context interface{}, db *db.DB, name string) error
Delete is used to remove an existing Regex document.
func GetAll
func GetAll(context interface{}, db *db.DB, tags []string) ([]Regex, error)
GetAll retrieves a list of regexs.
func GetByNames
func GetByNames(context interface{}, db *db.DB, names []string) ([]Regex, error)
GetByNames retrieves the documents for the specified names.
func GetNames
func GetNames(context interface{}, db *db.DB) ([]string, error)
GetNames retrieves a list of query regex names.
func Upsert
func Upsert(context interface{}, db *db.DB, rgx Regex) error
Upsert is used to create or update an existing Regex document.
type Regex
type Regex struct {
Name string `bson:"name" json:"name" validate:"required,min=3"`
Expr string `bson:"expr" json:"expr" validate:"required,min=3"`
Compile *regexp.Regexp
}
Regex contains a single regular expresion bound to a name.
func GetByName
func GetByName(context interface{}, db *db.DB, name string) (Regex, error)
GetByName retrieves the document for the specified Regex.
func GetLastHistoryByName
func GetLastHistoryByName(context interface{}, db *db.DB, name string) (Regex, error)
GetLastHistoryByName gets the last written Regex within the history.
func (Regex) Validate
func (r Regex) Validate() error
Validate checks the regex value for consistency and that it compiles.
Generated by godoc2md
# Packages
No description provided by the author
# Functions
Delete is used to remove an existing Regex document.
GetAll retrieves a list of regexs.
GetByName retrieves the document for the specified Regex.
GetByNames retrieves the documents for the specified names.
GetLastHistoryByName gets the last written Regex within the history.
GetNames retrieves a list of query regex names.
Upsert is used to create or update an existing Regex document.
# Constants
Contains the name of Mongo collections.
Contains the name of Mongo collections.
# Variables
Set of error variables.