Documentation
¶
Overview ¶
Package ast declares the types used to represent syntax trees for the .env file.
Index ¶
- type Assignment
- func (a *Assignment) BelongsToGroup(name string) bool
- func (a *Assignment) Documentation(withoutPrefix bool) string
- func (a *Assignment) HasComments() bool
- func (a *Assignment) Is(other Statement) bool
- func (a *Assignment) SetQuote(in string)
- func (a *Assignment) Type() string
- func (a *Assignment) ValidationRules() string
- type Comment
- type Document
- func (d *Document) Assignments() []*Assignment
- func (d *Document) BelongsToGroup(name string) 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(name string) *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 (doc *Document) Set(input *Assignment, options SetOptions) (bool, error)
- func (d *Document) Type() string
- type Group
- type Newline
- type Position
- 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) BelongsToGroup ¶
func (a *Assignment) BelongsToGroup(name string) bool
func (*Assignment) Documentation ¶ added in v0.2.0
func (a *Assignment) Documentation(withoutPrefix bool) string
func (*Assignment) HasComments ¶
func (a *Assignment) HasComments() bool
func (*Assignment) Is ¶
func (a *Assignment) Is(other Statement) bool
func (*Assignment) SetQuote ¶
func (a *Assignment) SetQuote(in string)
func (*Assignment) Type ¶ added in v0.3.0
func (a *Assignment) Type() 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 ¶
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 (*Document) EnsureGroup ¶ added in v0.1.0
func (*Document) Get ¶
func (d *Document) Get(name string) *Assignment
func (*Document) GetPosition ¶
func (d *Document) GetPosition(name string) (int, *Assignment)
func (*Document) Set ¶
func (doc *Document) Set(input *Assignment, options SetOptions) (bool, error)
type Group ¶
type Group struct { Name string `json:"name"` // Name of the group (within the header) Statements []Statement `json:"statements"` // Statements within the group Position Position `json:"position"` // Positional information about the group }
func (*Group) BelongsToGroup ¶
type Newline ¶
type Position ¶
type SetOptions ¶
Click to show internal directories.
Click to hide internal directories.