model

package
v0.4.16 Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2025 License: Apache-2.0 Imports: 9 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

@Author: link a624669980@163.com

*@Date: 2022-05-16 17:37:08
*@LastEditors: LinkLeong
*@LastEditTime: 2022-07-13 10:46:38
*@FilePath: /CasaOS/model/category.go
*@Description:

@Author: LinkLeong link@icewhale.com

*@Date: 2021-12-08 18:10:25
*@LastEditors: LinkLeong
*@LastEditTime: 2022-07-13 10:49:16
*@FilePath: /CasaOS/model/docker.go
*@Description:
*@Website: https://www.casaos.io
*Copyright (c) 2022 by icewhale, All Rights Reserved.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type APPModel

type APPModel struct {
	LogPath      string
	LogSaveName  string
	LogFileExt   string
	AppStorePath string
	AppsPath     string
}

type CasaOSGlobalVariables

type CasaOSGlobalVariables struct {
	AppChange bool
}

type Category added in v0.4.4

type Category struct {
	ID uint `gorm:"column:id;primary_key" json:"id"`
	//CreatedAt time.Time `json:"created_at"`
	//
	//UpdatedAt time.Time `json:"updated_at"`
	Font  string `json:"font"` // @tiger - 如果这个和前端有关,应该不属于后端的出参范围,而是前端去界定
	Name  string `json:"name"`
	Count uint   `json:"count"` // @tiger - count 属于动态信息,应该单独放在一个出参结构中(原因见另外一个关于 静态/动态 出参的注释)
}

type CommonModel

type CommonModel struct {
	RuntimePath string
}

type CustomizationPostData

type CustomizationPostData struct {
	ContainerName string    `json:"container_name"`
	CustomID      string    `json:"custom_id"`
	Origin        string    `json:"origin"`
	NetworkModel  string    `json:"network_model"`
	Index         string    `json:"index"`
	Icon          string    `json:"icon"`
	Image         string    `json:"image"`
	Envs          EnvArray  `json:"envs"`
	Ports         PortArray `json:"ports"`
	Volumes       PathArray `json:"volumes"`
	Devices       PathArray `json:"devices"`
	// Port         string    `json:"port,omitempty"`
	PortMap     string   `json:"port_map"`
	CPUShares   int64    `json:"cpu_shares"`
	Memory      int64    `json:"memory"`
	Restart     string   `json:"restart"`
	EnableUPNP  bool     `json:"enable_upnp"`
	Label       string   `json:"label"`
	Description string   `json:"description"`
	Position    bool     `json:"position"`
	HostName    string   `json:"host_name"`
	Privileged  bool     `json:"privileged"`
	CapAdd      []string `json:"cap_add"`
	Cmd         []string `json:"cmd"`
	Protocol    string   `json:"protocol"`
	Host        string   `json:"host"`
	AppStoreID  uint     `json:"appstore_id"`
}

func (*CustomizationPostData) AppStoreInfo added in v0.4.4

func (c *CustomizationPostData) AppStoreInfo() codegen.AppStoreInfo

func (*CustomizationPostData) Compose added in v0.4.4

func (*CustomizationPostData) ComposeAppStoreInfo added in v0.4.4

func (c *CustomizationPostData) ComposeAppStoreInfo() codegen.ComposeAppStoreInfo

func (*CustomizationPostData) Services added in v0.4.4

func (c *CustomizationPostData) Services() types.Services

type Devices

type Devices struct {
	ContainerPath string `json:"container_path"`
	Path          string `json:"path"`
	Desc          string `json:"desc"`
	Type          int    `json:"type"` //  1:必选 2:可选 3:默认值不必显示 4:系统处理 5:container内容也可编辑
}

type DockerDaemonConfigurationModel

type DockerDaemonConfigurationModel struct {
	// e.g. `/var/lib/docker`
	Root string `json:"data-root,omitempty"`
}

reference - https://docs.docker.com/engine/reference/commandline/dockerd/#daemon-configuration-file

type DockerStatsModel

type DockerStatsModel struct {
	Icon     string      `json:"icon"`
	Title    string      `json:"title"`
	Data     interface{} `json:"data"`
	Previous interface{} `json:"previous"`
}

type Env

type Env struct {
	Name  string `json:"container"`
	Value string `json:"host"`
	Desc  string `json:"desc"`
	Type  int    `json:"type"`
}

type EnvArray

type EnvArray []Env

func (*EnvArray) EnvStoreInfoList added in v0.4.4

func (ea *EnvArray) EnvStoreInfoList() []codegen.EnvStoreInfo

func (*EnvArray) ToMappingWithEquals added in v0.4.4

func (ea *EnvArray) ToMappingWithEquals() types.MappingWithEquals

type Envs

type Envs struct {
	Name  string `json:"name"`
	Value string `json:"value"`
	Desc  string `json:"desc"`
	Type  int    `json:"type"` //  1:必选 2:可选 3:默认值不必显示 4:系统处理 5:container内容也可编辑
}

type GlobalModel added in v0.4.4

type GlobalModel struct {
	OpenAIAPIKey string
}

type MapStrings

type MapStrings []map[string]string

type MyAppList

type MyAppList struct {
	ID             string `json:"id"`
	Name           string `json:"name"`
	Icon           string `json:"icon"`
	State          string `json:"state"`
	CustomID       string `gorm:"column:custom_id;primary_key" json:"custom_id"`
	Index          string `json:"index"`
	Port           string `json:"port"`
	Slogan         string `json:"slogan"`
	Type           string `json:"type"`
	Image          string `json:"image"`
	Volumes        string `json:"volumes"`
	Latest         bool   `json:"latest"`
	Host           string `json:"host"`
	Protocol       string `json:"protocol"`
	Created        int64  `json:"created"`
	AppStoreID     uint   `json:"appstore_id"`
	IsUncontrolled bool   `json:"is_uncontrolled"`
}

type PathArray

type PathArray []PathMap

func (*PathArray) DeviceStoreInfoList added in v0.4.4

func (p *PathArray) DeviceStoreInfoList() []codegen.DeviceStoreInfo

func (*PathArray) ServiceVolumeConfigList added in v0.4.4

func (p *PathArray) ServiceVolumeConfigList() []types.ServiceVolumeConfig

func (*PathArray) ToSlice added in v0.4.4

func (p *PathArray) ToSlice() []string

func (*PathArray) VolumeStoreInfoList added in v0.4.4

func (p *PathArray) VolumeStoreInfoList() []codegen.VolumeStoreInfo

type PathMap

type PathMap struct {
	ContainerPath string `json:"container"`
	Path          string `json:"host"`
	Type          int    `json:"type"`
	Desc          string `json:"desc"`
}

type PortArray

type PortArray []PortMap

func (*PortArray) PortStoreInfoList added in v0.4.4

func (p *PortArray) PortStoreInfoList() []codegen.PortStoreInfo

func (*PortArray) ServicePortConfigList added in v0.4.4

func (p *PortArray) ServicePortConfigList() []types.ServicePortConfig

type PortMap

type PortMap struct {
	ContainerPort string `json:"container"`
	CommendPort   string `json:"host"`
	Protocol      string `json:"protocol"`
	Desc          string `json:"desc"`
	Type          int    `json:"type"`
}

func (*PortMap) ServicePortConfig added in v0.4.4

func (p *PortMap) ServicePortConfig() (types.ServicePortConfig, error)

type Ports

type Ports struct {
	ContainerPort uint   `json:"container_port"`
	CommendPort   int    `json:"commend_port"`
	Desc          string `json:"desc"`
	Type          int    `json:"type"` //  1:必选 2:可选 3:默认值不必显示 4:系统处理  5:container内容也可编辑
}

type ServerAppList

type ServerAppList struct {
	ID             uint      `gorm:"column:id;primary_key" json:"id"`
	Title          string    `json:"title"`
	Description    string    `json:"description"`
	Tagline        string    `json:"tagline"`
	Tags           Strings   `gorm:"type:json" json:"tags"`
	Icon           string    `json:"icon"`
	ScreenshotLink Strings   `gorm:"type:json" json:"screenshot_link"`
	Category       string    `json:"category"`
	CategoryID     int       `json:"category_id"`
	CategoryFont   string    `json:"category_font"`
	PortMap        string    `json:"port_map"`
	ImageVersion   string    `json:"image_version"`
	Tip            string    `json:"tip"`
	Envs           EnvArray  `json:"envs"`
	Ports          PortArray `json:"ports"`
	Volumes        PathArray `json:"volumes"`
	Devices        PathArray `json:"devices"`
	NetworkModel   string    `json:"network_model"`
	Image          string    `json:"image"`
	Index          string    `json:"index"`
	CreatedAt      time.Time `json:"created_at"`
	UpdatedAt      time.Time `json:"updated_at"`
	State          StateEnum `json:"state"`
	Author         string    `json:"author"`
	MinMemory      int       `json:"min_memory"`
	MinDisk        int       `json:"min_disk"`
	Thumbnail      string    `json:"thumbnail"`
	Healthy        string    `json:"healthy"`
	Plugins        Strings   `json:"plugins"`
	Origin         string    `json:"origin"`
	Type           int       `json:"type"`
	QueryCount     int       `json:"query_count"`
	Developer      string    `json:"developer"`
	HostName       string    `json:"host_name"`
	Privileged     bool      `json:"privileged"`
	CapAdd         Strings   `json:"cap_add"`
	Cmd            Strings   `json:"cmd"`
	Architectures  Strings   `json:"architectures"`
	LatestDigest   Strings   `json:"latest_digests"`
}

@tiger - 对于用于出参的数据结构,静态信息(例如 title)和

动态信息(例如 state、query_count)应该划分到不同的数据结构中

这样的好处是
1 - 多次获取动态信息时可以减少出参复杂度,因为静态信息只获取一次就好
2 - 在未来的迭代中,可以降低维护成本(所有字段都展开放在一个层级维护成本略高)

另外,一些针对性字段,例如 Docker 相关的,可以用 map 来保存。
这样在未来增加多态 App,例如 Snap,不需要维护多个结构,或者一个结构保存不必要的字段

type ServerAppListCollection

type ServerAppListCollection struct {
	List      []ServerAppList `json:"list"`
	Recommend []ServerAppList `json:"recommend"`
	Community []ServerAppList `json:"community"`
}

type ServerCategoryList

type ServerCategoryList struct {
	Item []Category `json:"item"`
}

type ServerModel

type ServerModel struct {
	AppStoreList []string `ini:"appstore,,allowshadow"`
}

type StateEnum added in v0.4.1

type StateEnum int
const (
	StateEnumNotInstalled StateEnum = iota
	StateEnumInstalled
)

type Strings

type Strings []string

type TCPPorts

type TCPPorts struct {
	Desc          string `json:"desc"`
	ContainerPort int    `json:"container_port"`
}

type UDPPorts

type UDPPorts struct {
	Desc          string `json:"desc"`
	ContainerPort int    `json:"container_port"`
}

type Volume

type Volume struct {
	ContainerPath string `json:"container_path"`
	Path          string `json:"path"`
	Desc          string `json:"desc"`
	Type          int    `json:"type"` //  1:必选 2:可选 3:默认值不必显示 4:系统处理   5:container内容也可编辑
}

Jump to

Keyboard shortcuts

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