utilities

package
v0.0.0-...-f7d5a40 Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2020 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package reggen generates text based on regex definitions This lib is from https://github.com/lucasjones/reggen/blob/master/reggen.go

Index

Constants

View Source
const (
	LITERAL_PARAM     = "literal"
	UUID_PARAM        = "uuid"
	STRING_PATTERN    = "stringPattern"
	INTEGER_RANGE     = "intRange"
	PAYLOAD_RANGE     = "payloadRange"
	SEQUENTIAL_STRING = "sequentialString"
	TRANSIENT_MAP     = "transientMap"
)

Variables

This section is empty.

Functions

func GenerateChaincodeParams

func GenerateChaincodeParams(chaincodeParamArray []string, transientMap string, dynamicTransientMapKs []string, dynamicTransientMapVs []string, iterationIndex int) (chaincodeArgs []string, transientStaticMap, transientDynamicMap map[string][]byte, err error)

Generate chaincode arguments (common chaincode) and transientMap (private data chaincode)

func GenerateRegexString

func GenerateRegexString(regex string, limit int) (string, error)

func GetComplexArgs

func GetComplexArgs(complexParams []string, loopIndex int) ([]string, error)

func GetTransientMap

func GetTransientMap(complexParams []string, loopIndex int) ([]byte, error)

Types

type Generator

type Generator struct {
	// contains filtered or unexported fields
}

func NewGenerator

func NewGenerator(regex string) (*Generator, error)

create a new generator

func (*Generator) Generate

func (g *Generator) Generate(limit int) string

limit is the maximum number of times star, range or plus should repeat i.e. [0-9]+ will generate at most 10 characters if this is set to 10

type IntegerRange

type IntegerRange struct {
	Min string
	Max string
}

func (*IntegerRange) GetValue

func (p *IntegerRange) GetValue() (string, error)

type Literal

type Literal struct {
	Value string
}

func (*Literal) GetValue

func (p *Literal) GetValue() string

type PayloadRange

type PayloadRange struct {
	Min string
	Max string
}

func (*PayloadRange) GetValue

func (p *PayloadRange) GetValue() (string, error)

type SequentialString

type SequentialString struct {
	Value string
}

func (*SequentialString) GetValue

func (p *SequentialString) GetValue(loopIndex int) string

type StringPattern

type StringPattern struct {
	Regex string
}

func (*StringPattern) GetValue

func (p *StringPattern) GetValue() (string, error)

type UUID

type UUID struct {
}

func (*UUID) GetValue

func (p *UUID) GetValue() string

Jump to

Keyboard shortcuts

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