Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Generator ¶
type Generator interface { // AST is the entrypoint when parsing any AST. This delegates // to the specific functions below. // // It is given the context, the current AST to generate an expr from, // plus all parsed AST items and all currently generated Exprs AST(context.Context, []ParsedAST) ([]Expr, error) }
type Lit ¶
type Lit struct {
Value string
}
Lit represents a literal string value, which is returned as-is.
type ParsedAST ¶
type ParsedAST interface { // Kind represents the AST kind that the parsed AST represents. Kind() ParsedKind // name returns the name for the field, if specified. Name() string // SetDefault sets the default value, if found. SetDefault(to interface{}) }
ParsedAST is an interface which each parsed AST fulfills. This lets us specify an interface for eg. struct or enum member values.
type ParsedArray ¶
type ParsedArray struct { Members []ParsedAST Default interface{} Optional bool // contains filtered or unexported fields }
ParsedArray represents an array type sepcified within Cue.
A Cue array can contain many different types; it is not constrained to storing a single type. Due to this, we store all available parsed types within the Types field.
func (ParsedArray) Kind ¶
func (ParsedArray) Kind() ParsedKind
func (ParsedArray) Name ¶
func (p ParsedArray) Name() string
func (*ParsedArray) SetDefault ¶
func (p *ParsedArray) SetDefault(to interface{})
type ParsedEnum ¶
type ParsedEnum struct { Members []ParsedAST Default interface{} // contains filtered or unexported fields }
func (ParsedEnum) Kind ¶
func (ParsedEnum) Kind() ParsedKind
func (ParsedEnum) Name ¶
func (p ParsedEnum) Name() string
func (*ParsedEnum) SetDefault ¶
func (p *ParsedEnum) SetDefault(to interface{})
type ParsedIdent ¶
type ParsedIdent struct { // Type represnets the ast Ident that was parsed. Ident *ast.Ident // Default represents the default value, if any. Default interface{} // contains filtered or unexported fields }
ParsedIdent represents a single scalar type, eg. a string or a number
func (ParsedIdent) Kind ¶
func (ParsedIdent) Kind() ParsedKind
func (ParsedIdent) Name ¶
func (p ParsedIdent) Name() string
func (*ParsedIdent) SetDefault ¶
func (p *ParsedIdent) SetDefault(to interface{})
type ParsedKind ¶
type ParsedKind int
const ( KindNone ParsedKind = iota KindEnum KindStruct KindArray // KindIdent represents a single basic type KindIdent // KindScalar represents a single basic value KindScalar )
type ParsedScalar ¶
type ParsedScalar struct { Value interface{} Default interface{} Optional bool // contains filtered or unexported fields }
ParsedScalar represents a single concrete scalar value, eg. a string instance "foo" or a number instance 42.
func (ParsedScalar) Kind ¶
func (ParsedScalar) Kind() ParsedKind
func (ParsedScalar) Name ¶
func (p ParsedScalar) Name() string
func (*ParsedScalar) SetDefault ¶
func (*ParsedScalar) SetDefault(to interface{})
SetDefault is a no-op with scalars, as they're concrete.
type ParsedStruct ¶
type ParsedStruct struct { Members []*ParsedStructField Default interface{} // contains filtered or unexported fields }
func (ParsedStruct) Kind ¶
func (ParsedStruct) Kind() ParsedKind
func (ParsedStruct) Name ¶
func (p ParsedStruct) Name() string
func (*ParsedStruct) SetDefault ¶
func (p *ParsedStruct) SetDefault(to interface{})