core

package
v0.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 20, 2021 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var SharedExtractors = Extractors{}

Functions

func Extract

func Extract(v interface{}) (cueast.Expr, error)

func ExtractWithType

func ExtractWithType(v interface{}) (cueast.Expr, error)

func NewBytes

func NewBytes(data []byte) *cueast.BasicLit

func NewTripleBytes

func NewTripleBytes(data []byte) *cueast.BasicLit

func Register

func Register(extractor Extractor)

func SafeIdentifierFromImportPath

func SafeIdentifierFromImportPath(s string) string

Types

type Extractor

type Extractor interface {
	// Name
	// Extractor name
	// used in mod.cue @import("")
	Name() string
	// Detect check dir should use extractor.
	// if matched, return deps <repo>:<version> too.
	Detect(ctx context.Context, src string) (bool, map[string]string)
	// Extract convert dir to cue codes
	Extract(ctx context.Context, src string) ([]*cueast.File, error)
}

type Extractors

type Extractors map[string]Extractor

func (Extractors) Detect

func (extractors Extractors) Detect(ctx context.Context, src string) (string, map[string]string)

func (Extractors) ExtractToDir

func (extractors Extractors) ExtractToDir(ctx context.Context, name string, src string, gen string) error

func (Extractors) Register

func (extractors Extractors) Register(extractor Extractor)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL