Documentation
¶
Index ¶
- Constants
- Variables
- func RegisterContextBuilder()
- type AbsConfigPath
- type BuildOptions
- type ConfigGraph
- type ConfigPath
- type Context
- type ContextBuilder
- type ErrorContext
- func (e *ErrorContext) AppendError(err error) Context
- func (e *ErrorContext) Child(idx int) Context
- func (e *ErrorContext) Clone() Context
- func (e *ErrorContext) ConfigLines(isDumping bool) ([]string, error)
- func (e *ErrorContext) Disable() Context
- func (e *ErrorContext) Enable() Context
- func (e *ErrorContext) Error() error
- func (e *ErrorContext) Father() Context
- func (e *ErrorContext) HasChild() bool
- func (e *ErrorContext) Insert(ctx Context, idx int) Context
- func (e *ErrorContext) IsEnabled() bool
- func (e *ErrorContext) Len() int
- func (e *ErrorContext) Modify(ctx Context, idx int) Context
- func (e *ErrorContext) QueryAllByKeyWords(kw KeyWords) []Pos
- func (e *ErrorContext) QueryByKeyWords(kw KeyWords) Pos
- func (e *ErrorContext) Remove(idx int) Context
- func (e *ErrorContext) SetFather(ctx Context) error
- func (e *ErrorContext) SetValue(v string) error
- func (e *ErrorContext) Type() context_type.ContextType
- func (e *ErrorContext) Value() string
- type KeyWords
- type ParseType
- type Pos
- type RelConfigPath
Constants ¶
View Source
const ( RegexpMatchingListenPortValue = `^listen\s*(\d+)\s*\S*$` RegexpMatchingServerNameValue = `^server_name\s*(.+)$` )
Variables ¶
View Source
var ( ErrIndexOutOfRange = errors.New("index out of range") ErrInsertParserTypeError = errors.New("insert parser type error") ErrInsertIntoErrorContext = errors.WithCode(code.ErrV3OperationOnErrorContext, "insert context into an error context") ErrRemoveFromErrorContext = errors.WithCode(code.ErrV3OperationOnErrorContext, "remove context from an error context") ErrModifyFromErrorContext = errors.WithCode(code.ErrV3OperationOnErrorContext, "modify context from an error context") ErrSetValueToErrorContext = errors.WithCode(code.ErrV3OperationOnErrorContext, "set value to an error context") ErrSetFatherToErrorContext = errors.WithCode(code.ErrV3OperationOnErrorContext, "set father to an error context") ErrGetFatherFromErrorContext = errors.WithCode(code.ErrV3OperationOnErrorContext, "get father from an error context") ErrGetChildFromErrorContext = errors.WithCode(code.ErrV3OperationOnErrorContext, "get child from an error context") ErrParseConfigFromErrorContext = errors.WithCode(code.ErrV3OperationOnErrorContext, "parse config from an error context") ErrNullPosition = errors.WithCode(code.ErrV3NullContextPosition, "null position") ErrNullContext = errors.New("null context") )
Functions ¶
func RegisterContextBuilder ¶
func RegisterContextBuilder()
Types ¶
type AbsConfigPath ¶
type AbsConfigPath struct {
// contains filtered or unexported fields
}
func (AbsConfigPath) BaseDir ¶
func (a AbsConfigPath) BaseDir() string
func (AbsConfigPath) FullPath ¶
func (a AbsConfigPath) FullPath() string
func (AbsConfigPath) RelativePath ¶
func (a AbsConfigPath) RelativePath() string
type BuildOptions ¶
type BuildOptions struct { ContextType context_type.ContextType ParseType ParseType HasValue bool }
type ConfigGraph ¶
type ConfigGraph interface { AddEdge(src, dst ConfigPath) error CropOffEde(src, dst ConfigPath) MainConfigPath() ConfigPath }
type ConfigPath ¶
func NewAbsConfigPath ¶
func NewAbsConfigPath(absPath string) (ConfigPath, error)
func NewRelConfigPath ¶
func NewRelConfigPath(dir, file string) (ConfigPath, error)
type Context ¶
type Context interface { // write `Context` methods Insert(ctx Context, idx int) Context Remove(idx int) Context Modify(ctx Context, idx int) Context // read `Context` methods Father() Context Child(idx int) Context QueryByKeyWords(kw KeyWords) Pos QueryAllByKeyWords(kw KeyWords) []Pos Clone() Context // write methods SetValue(v string) error SetFather(ctx Context) error // read methods HasChild() bool Len() int Value() string Type() context_type.ContextType Error() error // dump ConfigLines(isDumping bool) ([]string, error) // Enable/Disable conversion methods IsEnabled() bool Enable() Context Disable() Context }
func ErrContext ¶
func NullContext ¶
func NullContext() Context
type ContextBuilder ¶
type ContextBuilder interface { SetType(contextType context_type.ContextType) ContextBuilder SetValue(value string) ContextBuilder Build() Context }
type ErrorContext ¶
type ErrorContext struct {
// contains filtered or unexported fields
}
func (*ErrorContext) AppendError ¶
func (e *ErrorContext) AppendError(err error) Context
func (*ErrorContext) Child ¶
func (e *ErrorContext) Child(idx int) Context
func (*ErrorContext) Clone ¶
func (e *ErrorContext) Clone() Context
func (*ErrorContext) ConfigLines ¶
func (e *ErrorContext) ConfigLines(isDumping bool) ([]string, error)
func (*ErrorContext) Disable ¶
func (e *ErrorContext) Disable() Context
func (*ErrorContext) Enable ¶
func (e *ErrorContext) Enable() Context
func (*ErrorContext) Error ¶
func (e *ErrorContext) Error() error
func (*ErrorContext) Father ¶
func (e *ErrorContext) Father() Context
func (*ErrorContext) HasChild ¶
func (e *ErrorContext) HasChild() bool
func (*ErrorContext) IsEnabled ¶
func (e *ErrorContext) IsEnabled() bool
func (*ErrorContext) Len ¶
func (e *ErrorContext) Len() int
func (*ErrorContext) QueryAllByKeyWords ¶
func (e *ErrorContext) QueryAllByKeyWords(kw KeyWords) []Pos
func (*ErrorContext) QueryByKeyWords ¶
func (e *ErrorContext) QueryByKeyWords(kw KeyWords) Pos
func (*ErrorContext) Remove ¶
func (e *ErrorContext) Remove(idx int) Context
func (*ErrorContext) SetFather ¶
func (e *ErrorContext) SetFather(ctx Context) error
func (*ErrorContext) SetValue ¶
func (e *ErrorContext) SetValue(v string) error
func (*ErrorContext) Type ¶
func (e *ErrorContext) Type() context_type.ContextType
func (*ErrorContext) Value ¶
func (e *ErrorContext) Value() string
type KeyWords ¶
type KeyWords interface { Match(ctx Context) bool SkipQueryThisContext(ctx Context) bool Cascaded() bool SetCascaded(cascaded bool) KeyWords SetStringMatchingValue(value string) KeyWords SetRegexpMatchingValue(value string) KeyWords SetSkipQueryFilter(filterFunc func(targetCtx Context) bool) KeyWords }
func NewKeyWords ¶
func NewKeyWords(ctxtype context_type.ContextType) KeyWords
type Pos ¶
func NotFoundPos ¶
func NotFoundPos() Pos
type RelConfigPath ¶
type RelConfigPath struct {
// contains filtered or unexported fields
}
func (RelConfigPath) BaseDir ¶
func (c RelConfigPath) BaseDir() string
func (RelConfigPath) FullPath ¶
func (c RelConfigPath) FullPath() string
func (RelConfigPath) RelativePath ¶
func (c RelConfigPath) RelativePath() string
Source Files
¶
Click to show internal directories.
Click to hide internal directories.