regex

package
v0.4.8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 4, 2016 License: Apache-2.0 Imports: 11 Imported by: 0

README

regex

import "github.com/coralproject/shelf/internal/xenia/regex"

Overview

Package regex provides the service layer for building apps using regex functionality.

Index

Package files

model.go regex.go

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

Documentation

Overview

Package regex provides the service layer for building apps using regex functionality.

Index

Constants

View Source
const (
	Collection        = "query_regexs"
	CollectionHistory = "query_regexs_history"
)

Contains the name of Mongo collections.

Variables

View Source
var (
	ErrNotFound = errors.New("Regex Not found")
)

Set of error variables.

Functions

func Delete

func Delete(context interface{}, db *db.DB, name string) error

Delete is used to remove an existing Regex document.

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.

Types

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 GetAll

func GetAll(context interface{}, db *db.DB, tags []string) ([]Regex, error)

GetAll retrieves a list of regexs.

func GetByName

func GetByName(context interface{}, db *db.DB, name string) (Regex, error)

GetByName retrieves the document for the specified Regex.

func GetByNames

func GetByNames(context interface{}, db *db.DB, names []string) ([]Regex, error)

GetByNames retrieves the documents for the specified names.

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.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL