api

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2023 License: Apache-2.0 Imports: 15 Imported by: 9

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetKclPkgPath added in v0.3.4

func GetKclPkgPath() (string, error)

GetKclPkgPath will return the value of $KCL_PKG_PATH.

If $KCL_PKG_PATH does not exist, it will return '$HOME/.kcl/kpm' by default.

func IsSchema added in v0.3.4

func IsSchema(kt *KclType) bool

IsSchema returns true if the type is schema.

func IsSchemaInstance added in v0.3.4

func IsSchemaInstance(kt *KclType) bool

IsSchemaInstance returns true if the type is schema instance.

func IsSchemaNamed added in v0.3.4

func IsSchemaNamed(kt *KclType, name string) bool

IsSchemaNamed returns true if the type is schema and the name is equal to the given name.

func IsSchemaType added in v0.3.4

func IsSchemaType(kt *KclType) bool

IsSchemaType returns true if the type is schema type.

func RunCurrentPkg added in v0.3.5

func RunCurrentPkg(opts *opt.CompileOptions) (*kcl.KCLResultList, error)

RunCurrentPkg will compile the current kcl package.

func RunOci

func RunOci(ociRef, version string, opts *opt.CompileOptions) (string, error)

RunOci will compile the kcl package from an OCI reference.

func RunOciPkg added in v0.3.5

func RunOciPkg(ociRef, version string, opts *opt.CompileOptions) (*kcl.KCLResultList, error)

RunOciPkg will compile the kcl package from an OCI reference.

func RunPkg

func RunPkg(opts *opt.CompileOptions) (string, error)

RunPkg will compile current kcl package.

func RunPkgInPath

func RunPkgInPath(opts *opt.CompileOptions) (string, error)

RunPkgInPath will load the 'KclPkg' from path 'pkgPath'. And run the kcl package with entry file in 'entryFilePath' in 'vendorMode'.

func RunPkgWithOpt added in v0.3.5

func RunPkgWithOpt(opts *opt.CompileOptions) (*kcl.KCLResultList, error)

RunPkgWithOpt will compile the kcl package with the compile options.

func RunTar

func RunTar(tarPath string, opts *opt.CompileOptions) (string, error)

RunTar will compile the kcl package from a kcl package tar.

func RunTarPkg added in v0.3.5

func RunTarPkg(tarPath string, opts *opt.CompileOptions) (*kcl.KCLResultList, error)

RunTarPkg will compile the kcl package from a kcl package tar.

func RunWithOpt added in v0.3.6

func RunWithOpt(opts *opt.CompileOptions) (*kcl.KCLResultList, error)

CompileWithOpts will compile the kcl program without kcl package.

Types

type KclPackage added in v0.3.4

type KclPackage struct {
	// contains filtered or unexported fields
}

The KCL Package

func GetKclPackage added in v0.3.4

func GetKclPackage(pkgPath string) (*KclPackage, error)

GetKclPackage returns the kcl package infomation.

'pkgPath' is the root path of the package where the 'kcl.mod' is located in.

'kcl_pkg_path' is the path of dependencies download by kpm.

func (*KclPackage) GetAllSchemaTypeMapping added in v0.3.4

func (pkg *KclPackage) GetAllSchemaTypeMapping() (map[string]map[string]*KclType, error)

GetAllSchemaTypeMapping returns all the schema types of the package.

It will return a map of schema types, the key is the relative path to the package home path.

And, the value is a map of schema types, the key is the schema name, the value is the schema type.

func (*KclPackage) GetDependencies added in v0.3.4

func (pkg *KclPackage) GetDependencies() pkg.Dependencies

GetDependencies returns the dependencies of the package.

func (*KclPackage) GetEdition added in v0.3.4

func (pkg *KclPackage) GetEdition() string

GetPkgEdition returns the kcl compiler edition of the package.

func (*KclPackage) GetPkgHomePath added in v0.3.4

func (pkg *KclPackage) GetPkgHomePath() string

GetPkgHomePath returns the home path of the package.

func (*KclPackage) GetPkgName added in v0.3.4

func (pkg *KclPackage) GetPkgName() string

GetPkgName returns the name of the package.

func (*KclPackage) GetPkgProfile added in v0.3.4

func (pkg *KclPackage) GetPkgProfile() pkg.Profile

GetPkgProfile returns the profile of the package.

func (*KclPackage) GetSchemaTypeMappingNamed added in v0.3.4

func (pkg *KclPackage) GetSchemaTypeMappingNamed(schemaName string) (map[string]map[string]*KclType, error)

GetSchemaTypeMappingNamed returns the schema type filtered by schema name.

If 'schemaName' is empty, it will return all the schema types.

func (*KclPackage) GetSchemaTypeMappingWithFilters added in v0.3.4

func (pkg *KclPackage) GetSchemaTypeMappingWithFilters(fileterFuncs []KclTypeFilterFunc) (map[string]map[string]*KclType, error)

GetSchemaTypeMappingWithFilters returns the schema type filtered by the filter functions.

func (*KclPackage) GetVersion added in v0.3.4

func (pkg *KclPackage) GetVersion() string

GetPkgVersion returns the version of the package.

func (*KclPackage) UpdateDependencyInPath added in v0.3.4

func (pkg *KclPackage) UpdateDependencyInPath(pkg_path string) error

UpdateDependencyInPath updates the dependencies in the path.

'pkg_path' is the path of dependencies download by kpm.

type KclType added in v0.3.4

type KclType struct {
	Name    string
	RelPath string
	*gpyrpc.KclType
}

An additional field 'Name' is added to the original 'KclType'.

'Name' is the name of the kcl type.

'RelPath' is the relative path to the package home path.

func NewKclTypes added in v0.3.4

func NewKclTypes(name, path string, tys *gpyrpc.KclType) *KclType

NewKclTypes returns a new KclType.

type KclTypeFilterFunc added in v0.3.4

type KclTypeFilterFunc func(kt *KclType) bool

Jump to

Keyboard shortcuts

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