package encoding
import "cuelang.org/go/internal/encoding"
Index ¶
- func Detect(v cue.Value) (i build.Interpretation)
- type Config
- type Decoder
- func NewDecoder(ctx *cue.Context, f *build.File, cfg *Config) *Decoder
- func (i *Decoder) Close()
- func (i *Decoder) Done() bool
- func (i *Decoder) Err() error
- func (i *Decoder) File() *ast.File
- func (i *Decoder) Filename() string
- func (i *Decoder) Index() int
- func (i *Decoder) Interpretation() build.Interpretation
- func (i *Decoder) Next()
- type Encoder
Functions ¶
func Detect ¶
func Detect(v cue.Value) (i build.Interpretation)
Detect detects the interpretation.
Types ¶
type Config ¶
type Config struct { Mode filetypes.Mode // Out specifies an overwrite destination. Out io.Writer Stdin io.Reader Stdout io.Writer PkgName string // package name for files to generate Force bool // overwrite existing files Strict bool // strict mode for jsonschema (deprecated) Stream bool // potentially write more than one document per file AllErrors bool Schema cue.Value // used for schema-based decoding EscapeHTML bool InlineImports bool // expand references to non-core imports ProtoPath []string Format []format.Option ParseFile func(name string, src interface{}) (*ast.File, error) }
type Decoder ¶
type Decoder struct {
// contains filtered or unexported fields
}
func NewDecoder ¶
NewDecoder returns a stream of non-rooted data expressions. The encoding type of f must be a data type, but does not have to be an encoding that can stream. stdin is used in case the file is "-".
This may change the contents of f.
func (*Decoder) Close ¶
func (i *Decoder) Close()
func (*Decoder) Done ¶
func (*Decoder) Err ¶
func (*Decoder) File ¶
func (*Decoder) Filename ¶
func (*Decoder) Index ¶
func (*Decoder) Interpretation ¶
func (i *Decoder) Interpretation() build.Interpretation
Interpretation returns the current interpretation detected by Detect.
func (*Decoder) Next ¶
func (i *Decoder) Next()
type Encoder ¶
type Encoder struct {
// contains filtered or unexported fields
}
An Encoder converts CUE to various file formats, including CUE itself. An Encoder allows
func NewEncoder ¶
NewEncoder writes content to the file with the given specification.
func (Encoder) Close ¶
func (*Encoder) Encode ¶
func (*Encoder) EncodeFile ¶
func (*Encoder) IsConcrete ¶
IsConcrete reports whether the output is required to be concrete.
INTERNAL ONLY: this is just to work around a problem related to issue #553 of catching errors only after syntax generation, dropping line number information.
Source Files ¶
detect.go encoder.go encoding.go
Directories ¶
Path | Synopsis |
---|---|
internal/encoding/json | |
internal/encoding/yaml |
- Version
- v0.11.0-alpha.2
- Published
- Sep 24, 2024
- Platform
- js/wasm
- Imports
- 33 packages
- Last checked
- 47 minutes ago –
Tools for package owners.