config

package
v0.6.2 Latest Latest
Warning

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

Go to latest
Published: Dec 29, 2021 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ValidChars CharFilter = func(current, previous string) bool {
		return vailCharRegexp.MatchString(current)
	}

	In = func(chars ...string) CharFilter {
		return func(current, previous string) bool {
			for _, char := range chars {
				if char == current {
					return true
				}
			}
			return false
		}
	}

	Not = func(cf CharFilter) CharFilter {
		return func(current, previous string) bool {
			return !cf(current, previous)
		}
	}
)

Functions

func ToString

func ToString(bs []byte, indent int) string

func Writer

func Writer(indent int) *writer

Types

type CharFilter

type CharFilter func(current, previous string) bool

func (CharFilter) And

func (self CharFilter) And(cf ...CharFilter) CharFilter

func (CharFilter) Or

func (self CharFilter) Or(cf ...CharFilter) CharFilter

type Configuration

type Configuration = Directive

func MustParse

func MustParse(filename string) *Configuration

func MustParseWith

func MustParseWith(filename string, bs []byte) *Configuration

func Parse

func Parse(filename string) (cfg *Configuration, err error)

func ParseWith

func ParseWith(filename string, bs []byte) (cfg *Configuration, err error)

type Directive

type Directive struct {
	Line    int        `json:"line"`
	Virtual Virtual    `json:"virtual,omitempty"`
	Name    string     `json:"name"`
	Args    []string   `json:"args,omitempty"`
	Body    Directives `json:"body,omitempty"`
}

func NewDirective

func NewDirective(name string, args ...string) *Directive

func (*Directive) AddBody

func (d *Directive) AddBody(name string, args ...string) *Directive

func (*Directive) AddBodyDirective

func (d *Directive) AddBodyDirective(directive ...*Directive)

func (*Directive) BodyBytes

func (d *Directive) BodyBytes() []byte

func (*Directive) HasArgs

func (d *Directive) HasArgs() bool

func (*Directive) Pretty

func (d *Directive) Pretty(prefix int) string

func (*Directive) String

func (d *Directive) String() string

type DirectiveIterator

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

func (*DirectiveIterator) HasNext

func (ds *DirectiveIterator) HasNext() bool

func (*DirectiveIterator) Next

func (ds *DirectiveIterator) Next() *Directive

func (*DirectiveIterator) Remove

func (ds *DirectiveIterator) Remove()

type Directives

type Directives []*Directive

func (*Directives) Get

func (ds *Directives) Get(name string) *Directive

func (*Directives) Iterator

func (ds *Directives) Iterator() *DirectiveIterator

func (*Directives) Remove

func (ds *Directives) Remove(name string) *Directive

type Virtual

type Virtual string

Jump to

Keyboard shortcuts

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