util

package
v0.5.0-alpha Latest Latest
Warning

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

Go to latest
Published: Jun 27, 2022 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	KB = 1 << (10 * iota)
	MB
	GB
	TB
)
View Source
const DEFAULT_GCP_SERVICE_ACCOUNT_FILE = "https://artifacts.instill.tech/default-service-account.json"
View Source
const MaxBatchSize int = 32
View Source
const MaxImageSizeBytes int = 4 * MB

Variables

Functions

func ArtiVCGetTags

func ArtiVCGetTags(dir string, config datamodel.ArtiVCModelConfiguration) ([]string, error)

func ConvertAllJSONEnumValueToProtoStyle

func ConvertAllJSONEnumValueToProtoStyle(enumRegistry map[string]map[string]int32, i interface{})

ConvertAllJSONEnumValueToProtoStyle converts lowercase enum value to the Protobuf naming convention where the enum type is always prefixed and is UPPERCASE snake_case. For examples: - api in a Protobuf `Enum SourceType` type will be converted to SOURCE_TYPE_API - oauth2.0 in a Protobuf `Enum AuthFlowType` type will be converted to AUTH_FLOW_TYPE_OAUTH2_0

func ConvertAllJSONKeySnakeCase

func ConvertAllJSONKeySnakeCase(i interface{})

ConvertAllJSONKeySnakeCase traverses a JSON object to replace all keys to snake_case.

func DoSupportBatch

func DoSupportBatch(configFilePath string) (bool, error)

func GitHubClone

func GitHubClone(dir string, instanceConfig datamodel.GitHubModelInstanceConfiguration) error

func RemoveModelRepository

func RemoveModelRepository(modelRepositoryRoot string, namespace string, modelName string, instanceName string)

func ValidateFilePath

func ValidateFilePath(filePath string) error

validate to prevent security issue as https://codeql.github.com/codeql-query-help/go/go-path-injection/

Types

type GitHubInfo

type GitHubInfo struct {
	Description string `json:"description"`
	Visibility  string `json:"visibility"`
	Tags        []Tag
}

func GetGitHubRepoInfo

func GetGitHubRepoInfo(repo string) (GitHubInfo, error)

type ModelMeta

type ModelMeta struct {
	Tags []string
	Task string
}

func GetModelMetaFromReadme

func GetModelMetaFromReadme(readmeFilePath string) (*ModelMeta, error)

type Tag

type Tag struct {
	Name string `json:"name"`
}

Jump to

Keyboard shortcuts

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