Documentation ¶
Index ¶
- func GetKclPkgPath() (string, error)
- func IsSchema(kt *KclType) bool
- func IsSchemaInstance(kt *KclType) bool
- func IsSchemaNamed(kt *KclType, name string) bool
- func IsSchemaType(kt *KclType) bool
- func RunCurrentPkg(opts *opt.CompileOptions) (*kcl.KCLResultList, error)
- func RunOci(ociRef, version string, opts *opt.CompileOptions) (string, error)
- func RunOciPkg(ociRef, version string, opts *opt.CompileOptions) (*kcl.KCLResultList, error)
- func RunPkg(opts *opt.CompileOptions) (string, error)
- func RunPkgInPath(opts *opt.CompileOptions) (string, error)
- func RunPkgWithOpt(opts *opt.CompileOptions) (*kcl.KCLResultList, error)
- func RunTar(tarPath string, opts *opt.CompileOptions) (string, error)
- func RunTarPkg(tarPath string, opts *opt.CompileOptions) (*kcl.KCLResultList, error)
- func RunWithOpt(opts *opt.CompileOptions) (*kcl.KCLResultList, error)
- func RunWithOpts(opts ...opt.Option) (*kcl.KCLResultList, error)
- type KclPackage
- func (pkg *KclPackage) GetAllSchemaTypeMapping() (map[string]map[string]*KclType, error)
- func (pkg *KclPackage) GetDependencies() pkg.Dependencies
- func (pkg *KclPackage) GetEdition() string
- func (pkg *KclPackage) GetFullSchemaTypeMappingWithFilters(kpmcli *client.KpmClient, fileterFuncs []KclTypeFilterFunc) (map[string]map[string]*KclType, error)
- func (pkg *KclPackage) GetPkgHomePath() string
- func (pkg *KclPackage) GetPkgName() string
- func (pkg *KclPackage) GetPkgProfile() *pkg.Profile
- func (pkg *KclPackage) GetSchemaTypeMappingNamed(schemaName string) (map[string]map[string]*KclType, error)
- func (pkg *KclPackage) GetSchemaTypeMappingWithFilters(fileterFuncs []KclTypeFilterFunc) (map[string]map[string]*KclType, error)
- func (pkg *KclPackage) GetVersion() string
- func (pkg *KclPackage) UpdateDependencyInPath(pkg_path string) error
- type KclType
- type KclTypeFilterFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetKclPkgPath ¶ added in v0.3.4
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 IsSchemaInstance ¶ added in v0.3.4
IsSchemaInstance returns true if the type is schema instance.
func IsSchemaNamed ¶ added in v0.3.4
IsSchemaNamed returns true if the type is schema and the name is equal to the given name.
func IsSchemaType ¶ added in v0.3.4
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. Deprecated: This method will not be maintained in the future. Use RunWithOpts instead.
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)
CompileWithOpt will compile the kcl program without kcl package. Deprecated: This method will not be maintained in the future. Use RunWithOpts instead.
func RunWithOpts ¶ added in v0.4.5
func RunWithOpts(opts ...opt.Option) (*kcl.KCLResultList, error)
RunWithOpts will compile the kcl package with the compile options.
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) GetFullSchemaTypeMappingWithFilters ¶ added in v0.4.2
func (pkg *KclPackage) GetFullSchemaTypeMappingWithFilters(kpmcli *client.KpmClient, fileterFuncs []KclTypeFilterFunc) (map[string]map[string]*KclType, error)
GetFullSchemaTypeMappingWithFilters returns the full schema type filtered by the filter functions.
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
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.