common

package module
v0.7.1 Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2026 License: Apache-2.0 Imports: 16 Imported by: 0

README

mtkgo/common

common package for mtk in go.

Documentation

Overview

Package common

Index

Constants

View Source
const (
	CloudVendorAlibaba string = "alibabacloud"
	CloudVendorHuawei  string = "huaweicloud"
)
View Source
const (
	CloudEnvTest string = "test"
	CloudEnvProd string = "prod"
)
View Source
const (
	DefaultAssetName = "asset.zip"
)

Variables

This section is empty.

Functions

func BuildZip added in v0.3.1

func BuildZip(ctx context.Context, assetFilesDir string, outputDir string, assetName string) error

func DetectSupportedFiles added in v0.3.2

func DetectSupportedFiles(dir string) ([]string, int64)

func IsBIM added in v0.5.0

func IsBIM(id FormatID) bool

func IsCAD added in v0.5.0

func IsCAD(id FormatID) bool

func UnZip added in v0.4.0

func UnZip(ctx context.Context, inputFile string, outputDir string, encodings ...encoding.Encoding) error

Types

type Claims

type Claims struct {
	jwt.RegisteredClaims
	UserID      string       `json:"userid"`
	Name        string       `json:"name,omitempty"` // only used for display, so use user.nickname
	AvatarURL   string       `json:"avatar_url,omitempty"`
	Roles       []string     `json:"roles,omitempty"` // like default springboot settings, has prefix "ROLE_"
	Permissions []Permission `json:"permissions,omitempty"`
}

type CloudEnv

type CloudEnv struct {
	Vendor string
	Env    string
}

func GetCloudEnv

func GetCloudEnv() CloudEnv

func (*CloudEnv) IsCloud added in v0.2.0

func (env *CloudEnv) IsCloud() bool

func (*CloudEnv) IsProd added in v0.2.0

func (env *CloudEnv) IsProd() bool

type Format added in v0.3.2

type Format struct {
	ID          FormatID `json:"id"`
	Description string   `json:"description"`
	Extensions  []string `json:"extensions"`
}

func GetSupportedFormats added in v0.3.2

func GetSupportedFormats() []Format

type FormatID added in v0.5.0

type FormatID string

func GetFormatID added in v0.5.1

func GetFormatID(filename string) FormatID

type Formats added in v0.5.0

type Formats struct {
	Formats []Format   `json:"formats"`
	BIM     []FormatID `json:"bim"`
	CAD     []FormatID `json:"cad"`
}

type ModelPatch added in v0.3.0

type ModelPatch struct {
	NodePatches map[string]NodePatch `json:"nodePatches,omitempty"`
}

type NodePatch added in v0.3.0

type NodePatch struct {
	Matrix      *[16]float64 `json:"matrix,omitempty"`
	Translation *[3]float64  `json:"translation,omitempty"`
	Rotation    *[4]float64  `json:"rotation,omitempty"`
	Scale       *[3]float64  `json:"scale,omitempty"`
	Fields      []Property   `json:"fields,omitempty"`
}

type Permission

type Permission struct {
	Name     string `json:"name,omitempty"`
	ExpireAt int64  `json:"exp,omitempty"`
}

type Property added in v0.3.0

type Property struct {
	ID    string `json:"id"`
	Name  string `json:"name,omitempty"`
	Value any    `json:"value"`
}

type TaskInfo added in v0.3.0

type TaskInfo struct {
	Type  TaskType
	ID    string `json:"id"`
	ReRun bool   `json:"rerun,omitempty"`
	Async bool   `json:"async,omitempty"`

	ModelPatch *ModelPatch `json:"modelPatch,omitempty"`

	SimplifyParams *TaskSimplifyParams `json:"simplifyParams,omitempty"`
}

type TaskSimplifyParams added in v0.3.0

type TaskSimplifyParams struct {
	SimplifyFactor float32 `arg:"--simplify-factor" json:"simplifyFactor,omitempty"`
	MergeMaterials bool    `arg:"--merge-materials" json:"mergeMaterials,omitempty"`
	MaxTextureSize uint32  `arg:"--maximum-texture-size" json:"maximumTextureSize,omitempty"`
	TextureScale   float32 `arg:"--texture-scale" json:"textureScale,omitempty"`
	UseWebP        bool    `arg:"--use-webp" json:"useWebP,omitempty"`
	Draco          bool    `arg:"--draco" json:"draco,omitempty"`
	DracoPosBits   int32   `arg:"--draco-pos-quantization-bits" json:"dracoPosBits,omitempty"`

	OnlyExteriorNodes bool `arg:"--only-keep-exterior-nodes" json:"onlyExteriorNodes,omitempty"`
}

type TaskType added in v0.3.0

type TaskType string
const (
	TaskSlice    TaskType = "slice"
	TaskSimplify TaskType = "simplify"
)

type TokenKey

type TokenKey struct {
	Alg   string `json:"alg"`
	Value string `json:"value"`
}

func GetTokenKey

func GetTokenKey(tokenKeyURL string, clientID string, clientSecret string) (key *TokenKey, err error)

Directories

Path Synopsis
Package alibabacloud
Package alibabacloud
cmd
unzip command

Jump to

Keyboard shortcuts

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