Documentation ¶
Index ¶
- Constants
- 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 RunOci(ociRef, version string, opts *opt.CompileOptions) (*kcl.KCLResultList, error)
- func RunPkg(opts *opt.CompileOptions) (*kcl.KCLResultList, error)
- func RunPkgInPath(opts *opt.CompileOptions) (*kcl.KCLResultList, error)
- func RunTar(tarPath string, opts *opt.CompileOptions) (*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) 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 ¶
const KCL_PKG_TAR = "*.tar"
Variables ¶
This section is empty.
Functions ¶
func GetKclPkgPath ¶
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 ¶
IsSchemaInstance returns true if the type is schema instance.
func IsSchemaNamed ¶
IsSchemaNamed returns true if the type is schema and the name is equal to the given name.
func IsSchemaType ¶
IsSchemaType returns true if the type is schema type.
func RunOci ¶
func RunOci(ociRef, version string, opts *opt.CompileOptions) (*kcl.KCLResultList, error)
RunOci will compile the kcl package from an OCI reference.
func RunPkg ¶
func RunPkg(opts *opt.CompileOptions) (*kcl.KCLResultList, error)
RunPkg will compile current kcl package.
func RunPkgInPath ¶
func RunPkgInPath(opts *opt.CompileOptions) (*kcl.KCLResultList, error)
RunPkgInPath will load the 'KclPkg' from path 'pkgPath'. And run the kcl package with entry file in 'entryFilePath' in 'vendorMode'.
func RunTar ¶
func RunTar(tarPath string, opts *opt.CompileOptions) (*kcl.KCLResultList, error)
RunTar will compile the kcl package from a kcl package tar.
Types ¶
type KclPackage ¶
type KclPackage struct {
// contains filtered or unexported fields
}
The KCL Package
func GetKclPackage ¶
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 ¶
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 ¶
func (pkg *KclPackage) GetDependencies() pkg.Dependencies
GetDependencies returns the dependencies of the package.
func (*KclPackage) GetEdition ¶
func (pkg *KclPackage) GetEdition() string
GetPkgEdition returns the kcl compiler edition of the package.
func (*KclPackage) GetPkgHomePath ¶
func (pkg *KclPackage) GetPkgHomePath() string
GetPkgHomePath returns the home path of the package.
func (*KclPackage) GetPkgName ¶
func (pkg *KclPackage) GetPkgName() string
GetPkgName returns the name of the package.
func (*KclPackage) GetPkgProfile ¶
func (pkg *KclPackage) GetPkgProfile() pkg.Profile
GetPkgProfile returns the profile of the package.
func (*KclPackage) GetSchemaTypeMappingNamed ¶
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 ¶
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 ¶
func (pkg *KclPackage) GetVersion() string
GetPkgVersion returns the version of the package.
func (*KclPackage) UpdateDependencyInPath ¶
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 ¶
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.