Documentation
¶
Overview ¶
Package ast declares the types used to represent syntax trees for the .env file.
Index ¶
- type Assignment
- func (a *Assignment) Assignment(config RenderSettings) string
- func (a *Assignment) BelongsToGroup(config RenderSettings) bool
- func (a *Assignment) HasComments() bool
- func (a *Assignment) Is(other Statement) bool
- func (a *Assignment) Render(config RenderSettings) string
- func (a *Assignment) RenderDocumentation(withoutPrefix bool) string
- func (a *Assignment) SetQuote(in string)
- func (a *Assignment) ValidationRules() string
- type Comment
- type Document
- func (d *Document) Assignments() []*Assignment
- func (d *Document) BelongsToGroup(config RenderSettings) bool
- func (doc *Document) EnsureGroup(name string) *Group
- func (d *Document) Get(name string) *Assignment
- func (d *Document) GetConfig(name string) (string, error)
- func (d *Document) GetGroup(config RenderSettings) *Group
- func (d *Document) GetInterpolation(in string) (string, bool)
- func (d *Document) GetPosition(name string) (int, *Assignment)
- func (d *Document) Is(other Statement) bool
- func (d *Document) Render(config RenderSettings) string
- func (d *Document) RenderFull() string
- func (doc *Document) Set(input *Assignment, options SetOptions) (bool, error)
- type Group
- type Newline
- type Position
- type RenderSettings
- type SetOptions
- type Statement
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Assignment ¶
type Assignment struct {
Name string `json:"key"` // Name of the key (left hand side of the "=" sign)
Literal string `json:"literal"` // Value of the key (right hand side of the "=" sign)
Interpolated string `json:"value"` // Value of the key (after interpolation)
Complete bool `json:"complete"` // The key/value had no value/content after the "=" sign
Active bool `json:"commented"` // The assignment was commented out (#KEY=VALUE)
Quote token.Quote `json:"quote"` // The style of quotes used for the assignment
Group *Group `json:"-"` // The (optional) group this assignment belongs to
Comments []*Comment `json:"comments"` // Comments attached to the assignment (e.g. doc block before it)
Position Position `json:"position"` // Information about position of the assignment in the file
}
func (*Assignment) Assignment ¶
func (a *Assignment) Assignment(config RenderSettings) string
func (*Assignment) BelongsToGroup ¶
func (a *Assignment) BelongsToGroup(config RenderSettings) bool
func (*Assignment) HasComments ¶
func (a *Assignment) HasComments() bool
func (*Assignment) Is ¶
func (a *Assignment) Is(other Statement) bool
func (*Assignment) Render ¶
func (a *Assignment) Render(config RenderSettings) string
func (*Assignment) RenderDocumentation ¶
func (a *Assignment) RenderDocumentation(withoutPrefix bool) string
func (*Assignment) SetQuote ¶
func (a *Assignment) SetQuote(in string)
func (*Assignment) ValidationRules ¶
func (a *Assignment) ValidationRules() string
type Comment ¶
type Comment struct {
Value string `json:"value"` // The actual comment value
Annotation *token.Annotation `json:"annotation"` // If the comment was detected to be an annotation
Group *Group `json:"-"` // The (optional) group the comment belongs to
Position Position `json:"position"` // Information about position of the assignment in the file
}
Comment node represents a comment statement.
func NewComment ¶
func (*Comment) BelongsToGroup ¶
func (c *Comment) BelongsToGroup(config RenderSettings) bool
type Document ¶
type Document struct {
Statements []Statement `json:"statements"` // Statements belonging to the root of the document
Groups []*Group `json:"groups"` // Groups within the document
Annotations []*Comment `json:"-"` // Global annotations for configuration of dottie
}
Document node represents .env file statement, that contains assignments and comments.
func (*Document) Assignments ¶
func (d *Document) Assignments() []*Assignment
func (*Document) BelongsToGroup ¶
func (d *Document) BelongsToGroup(config RenderSettings) bool
func (*Document) EnsureGroup ¶ added in v0.1.0
func (*Document) Get ¶
func (d *Document) Get(name string) *Assignment
func (*Document) GetGroup ¶
func (d *Document) GetGroup(config RenderSettings) *Group
func (*Document) GetPosition ¶
func (d *Document) GetPosition(name string) (int, *Assignment)
func (*Document) Render ¶
func (d *Document) Render(config RenderSettings) string
func (*Document) RenderFull ¶
func (*Document) Set ¶
func (doc *Document) Set(input *Assignment, options SetOptions) (bool, error)
type Group ¶
type Group struct {
Name string // Name of the group (within the header)
Statements []Statement // Statements within the group
Position Position // Positional information about the group
}
func (*Group) BelongsToGroup ¶
func (g *Group) BelongsToGroup(config RenderSettings) bool
func (*Group) Render ¶
func (g *Group) Render(config RenderSettings) string
type Newline ¶
func (*Newline) BelongsToGroup ¶
func (n *Newline) BelongsToGroup(config RenderSettings) bool
func (*Newline) Render ¶
func (n *Newline) Render(config RenderSettings) string
type RenderSettings ¶
type RenderSettings struct {
FilterKeyPrefix string
FilterGroup string
IncludeCommented bool
ShowBlankLines bool
ShowColors bool
ShowComments bool
ShowGroups bool
ShowPretty bool
Interpolate bool
}
func (*RenderSettings) Match ¶
func (rs *RenderSettings) Match(assignment *Assignment) bool
func (*RenderSettings) WithBlankLines ¶
func (rs *RenderSettings) WithBlankLines() bool
func (*RenderSettings) WithColors ¶
func (rs *RenderSettings) WithColors() bool
func (*RenderSettings) WithComments ¶
func (rs *RenderSettings) WithComments() bool
func (*RenderSettings) WithGroups ¶
func (rs *RenderSettings) WithGroups() bool
type SetOptions ¶
Click to show internal directories.
Click to hide internal directories.