model

package
v0.4.4-3-alpha6 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2023 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

* @Author: LinkLeong link@icewhale.org * @Date: 2022-07-27 10:30:43 * @LastEditors: LinkLeong * @LastEditTime: 2022-08-04 20:06:04 * @FilePath: /CasaOS/model/connections.go * @Description: * @Website: https://www.casaos.io * Copyright (c) 2022 by icewhale, All Rights Reserved.

* @Author: LinkLeong link@icewhale.com * @Date: 2022-05-20 16:27:12 * @LastEditors: LinkLeong * @LastEditTime: 2022-06-09 18:18:46 * @FilePath: /CasaOS/model/file.go * @Description: * @Website: https://www.casaos.io * Copyright (c) 2022 by icewhale, All Rights Reserved.

* @Author: LinkLeong link@icewhale.org * @Date: 2022-07-26 11:12:12 * @LastEditors: LinkLeong * @LastEditTime: 2022-07-27 14:58:55 * @FilePath: /CasaOS/model/share.go * @Description: * @Website: https://www.casaos.io * Copyright (c) 2022 by icewhale, All Rights Reserved.

* @Author: LinkLeong link@icewhale.com * @Date: 2022-05-13 18:15:46 * @LastEditors: LinkLeong * @LastEditTime: 2022-09-02 22:12:34 * @FilePath: /CasaOS/model/sys_common.go * @Description: * @Website: https://www.casaos.io * Copyright (c) 2022 by icewhale, All Rights Reserved.

* @Author: LinkLeong link@icewhale.org * @Date: 2022-05-13 18:15:46 * @LastEditors: LinkLeong * @LastEditTime: 2022-08-01 18:32:57 * @FilePath: /CasaOS/model/zima.go * @Description: * @Website: https://www.casaos.io * Copyright (c) 2022 by icewhale, All Rights Reserved.

Index

Constants

View Source
const (
	SINGLE = iota
	SITE
	STYLE
	PREVIEW
	GLOBAL
	ARIA2
	INDEX
	GITHUB
)
View Source
const (
	PUBLIC = iota
	PRIVATE
	READONLY
	DEPRECATED
)
View Source
const MaxInt = int(MaxUint >> 1)
View Source
const MaxUint = ^uint(0)
View Source
const MinInt = -MaxInt - 1
View Source
const MinUint = 0

Variables

This section is empty.

Functions

func ExtractFolder added in v0.4.2

func ExtractFolder(objs []Obj, extractFolder string)

func GetThumb added in v0.4.2

func GetThumb(obj Obj) (thumb string, ok bool)

func GetUrl added in v0.4.2

func GetUrl(obj Obj) (url string, ok bool)

func SortFiles added in v0.4.2

func SortFiles(objs []Obj, orderBy, orderDirection string)

func WrapObjsName added in v0.4.2

func WrapObjsName(objs []Obj)

Types

type APPModel

type APPModel struct {
	LogPath        string
	LogSaveName    string
	LogFileExt     string
	DateStrFormat  string
	DateTimeFormat string
	UserDataPath   string
	TimeFormat     string
	DateFormat     string
	DBPath         string
	ShellPath      string
}

服务配置

type BaseInfo added in v0.3.8

type BaseInfo struct {
	Hash       string `json:"i"`
	Version    string `json:"v"`
	Channel    string `json:"c,omitempty"`
	DriveModel string `json:"m,omitempty"`
}

type CasaOSHeart added in v0.2.9

type CasaOSHeart struct {
	UuId string `json:"uuid"`
	Type string `json:"type"`
}

type CommonModel added in v0.3.6

type CommonModel struct {
	RuntimePath string
}

type Connections added in v0.3.5

type Connections struct {
	ID         uint   `json:"id"`
	Username   string `json:"username"`
	Password   string `json:"password,omitempty"`
	Host       string `json:"host"`
	Port       string `json:"port"`
	MountPoint string `json:"mount_point"`
}

type DeviceInfo added in v0.4.5

type DeviceInfo struct {
	LanIpv4     []string `json:"lan_ipv4"`
	Port        int      `json:"port"`
	DeviceName  string   `json:"device_name"`
	DeviceModel string   `json:"device_model"`
	DeviceSN    string   `json:"device_sn"`
	Initialized bool     `json:"initialized"`
	OS_Version  string   `json:"os_version"`
	Hash        string   `json:"hash"`
}

type Drive added in v0.2.6

type Drive struct {
	Name    string `json:"name"`
	Icon    string `json:"icon"`
	AuthUrl string `json:"auth_url"`
}

type FileItem added in v0.3.2

type FileItem struct {
	From          string `json:"from" binding:"required"`
	Finished      bool   `json:"finished"`
	Size          int64  `json:"size"`
	ProcessedSize int64  `json:"processed_size"`
}

type FileOperate added in v0.3.2

type FileOperate struct {
	Type          string     `json:"type" binding:"required"`
	Item          []FileItem `json:"item" binding:"required"`
	TotalSize     int64      `json:"total_size"`
	ProcessedSize int64      `json:"processed_size"`
	To            string     `json:"to" binding:"required"`
	Style         string     `json:"style"`
	Finished      bool       `json:"finished"`
}

type FileSetting added in v0.3.0

type FileSetting struct {
	ShareDir    []string `json:"share_dir" delim:"|"`
	DownloadDir string   `json:"download_dir"`
}

type FileStream added in v0.4.2

type FileStream struct {
	Obj
	io.ReadCloser
	Mimetype     string
	WebPutAsTask bool
	Old          Obj
}

func (*FileStream) GetMimetype added in v0.4.2

func (f *FileStream) GetMimetype() string

func (*FileStream) GetOld added in v0.4.2

func (f *FileStream) GetOld() Obj

func (*FileStream) GetReadCloser added in v0.4.2

func (f *FileStream) GetReadCloser() io.ReadCloser

func (*FileStream) NeedStore added in v0.4.2

func (f *FileStream) NeedStore() bool

func (*FileStream) SetReadCloser added in v0.4.2

func (f *FileStream) SetReadCloser(rc io.ReadCloser)

type FileStreamer added in v0.4.2

type FileStreamer interface {
	io.ReadCloser
	Obj
	GetMimetype() string
	SetReadCloser(io.ReadCloser)
	NeedStore() bool
	GetReadCloser() io.ReadCloser
	GetOld() Obj
}

type FileUpdate added in v0.3.2

type FileUpdate struct {
	FilePath    string `json:"path" binding:"required"`
	FileContent string `json:"content" binding:"required"`
}

type FsOtherArgs added in v0.4.2

type FsOtherArgs struct {
	Path   string      `json:"path" form:"path"`
	Method string      `json:"method" form:"method"`
	Data   interface{} `json:"data" form:"data"`
}

type GoDaddyModel

type GoDaddyModel struct {
	Type    uint   `json:"type"`
	ApiHost string `json:"api_host"`
	Key     string `json:"key"`
	Secret  string `json:"secret"`
	Host    string `json:"host"`
}

type IOCountersStat

type IOCountersStat struct {
	Name        string `json:"name"`        // interface name
	BytesSent   uint64 `json:"bytesSent"`   // number of bytes sent
	BytesRecv   uint64 `json:"bytesRecv"`   // number of bytes received
	PacketsSent uint64 `json:"packetsSent"` // number of packets sent
	PacketsRecv uint64 `json:"packetsRecv"` // number of packets received
	Errin       uint64 `json:"errin"`       // total number of errors while receiving
	Errout      uint64 `json:"errout"`      // total number of errors while sending
	Dropin      uint64 `json:"dropin"`      // total number of incoming packets which were dropped
	Dropout     uint64 `json:"dropout"`     // total number of outgoing packets which were dropped (always 0 on OSX and BSD)
	Fifoin      uint64 `json:"fifoin"`      // total number of FIFO buffers errors while receiving
	Fifoout     uint64 `json:"fifoout"`     // total number of FIFO buffers errors while sending
	State       string `json:"state"`
	Time        int64  `json:"time"`
}
type Link struct {
	URL        string         `json:"url"`
	Header     http.Header    `json:"header"` // needed header
	Data       io.ReadCloser  // return file reader directly
	Status     int            // status maybe 200 or 206, etc
	FilePath   *string        // local file, return the filepath
	Expiration *time.Duration // url expiration time
	Method     string         `json:"method"` // http method
}

type LinkArgs added in v0.4.2

type LinkArgs struct {
	IP     string
	Header http.Header
	Type   string
}

type ListArgs added in v0.4.2

type ListArgs struct {
	ReqPath string
}

type NotifyMssage added in v0.2.9

type NotifyMssage struct {
	Type string `json:"type"`
	Data string `json:"data"`
}

type Obj added in v0.4.2

type Obj interface {
	GetSize() int64
	GetName() string
	ModTime() time.Time
	IsDir() bool

	// The internal information of the driver.
	// If you want to use it, please understand what it means
	GetID() string
	GetPath() string
}

func UnwrapObjs added in v0.4.2

func UnwrapObjs(obj Obj) Obj

func WrapObjName added in v0.4.2

func WrapObjName(objs Obj) Obj

Wrap

type ObjMerge added in v0.4.2

type ObjMerge struct {
	// contains filtered or unexported fields
}

func NewObjMerge added in v0.4.2

func NewObjMerge() *ObjMerge

Merge

func (*ObjMerge) InitHideReg added in v0.4.2

func (om *ObjMerge) InitHideReg(hides string)

func (*ObjMerge) Merge added in v0.4.2

func (om *ObjMerge) Merge(objs []Obj, objs_ ...Obj) []Obj

func (*ObjMerge) Reset added in v0.4.2

func (om *ObjMerge) Reset()

type ObjThumb added in v0.4.2

type ObjThumb struct {
	Object
	Thumbnail
}

type ObjThumbURL added in v0.4.2

type ObjThumbURL struct {
	Object
	Thumbnail
	Url
}

type ObjWrapName added in v0.4.2

type ObjWrapName struct {
	Name string
	Obj
}

func (*ObjWrapName) GetName added in v0.4.2

func (o *ObjWrapName) GetName() string

func (*ObjWrapName) Unwrap added in v0.4.2

func (o *ObjWrapName) Unwrap() Obj

type Object added in v0.4.2

type Object struct {
	ID       string
	Path     string
	Name     string
	Size     int64
	Modified time.Time
	IsFolder bool
}

func (*Object) GetID added in v0.4.2

func (o *Object) GetID() string

func (*Object) GetName added in v0.4.2

func (o *Object) GetName() string

func (*Object) GetPath added in v0.4.2

func (o *Object) GetPath() string

func (*Object) GetSize added in v0.4.2

func (o *Object) GetSize() int64

func (*Object) IsDir added in v0.4.2

func (o *Object) IsDir() bool

func (*Object) ModTime added in v0.4.2

func (o *Object) ModTime() time.Time

func (*Object) SetPath added in v0.4.2

func (o *Object) SetPath(id string)

type ObjectURL added in v0.4.2

type ObjectURL struct {
	Object
	Url
}

type OtherArgs added in v0.4.2

type OtherArgs struct {
	Obj    Obj
	Method string
	Data   interface{}
}

type PageReq added in v0.4.2

type PageReq struct {
	Index int `json:"page" form:"index"`
	Size  int `json:"size" form:"size"`
}

func (*PageReq) Validate added in v0.4.2

func (p *PageReq) Validate()

type PageResp added in v0.4.2

type PageResp struct {
	Content interface{} `json:"content"`
	Total   int64       `json:"total"`
}

type Path

type Path struct {
	Name       string                 `json:"name"`   //File name or document name
	Path       string                 `json:"path"`   //Full path to file or folder
	IsDir      bool                   `json:"is_dir"` //Is it a folder
	Date       time.Time              `json:"date"`
	Size       int64                  `json:"size"` //File Size
	Type       string                 `json:"type,omitempty"`
	Label      string                 `json:"label,omitempty"`
	Write      bool                   `json:"write"`
	Extensions map[string]interface{} `json:"extensions"`
}

type Proxy added in v0.4.2

type Proxy struct {
	WebProxy     bool   `json:"web_proxy"`
	WebdavPolicy string `json:"webdav_policy"`
	DownProxyUrl string `json:"down_proxy_url"`
}

func (Proxy) Webdav302 added in v0.4.2

func (p Proxy) Webdav302() bool

func (Proxy) WebdavNative added in v0.4.2

func (p Proxy) WebdavNative() bool

func (Proxy) WebdavProxy added in v0.4.2

func (p Proxy) WebdavProxy() bool

type RedisModel

type RedisModel struct {
	Host        string
	Password    string
	MaxIdle     int
	MaxActive   int
	IdleTimeout time.Duration
}

redis配置文件

type Result

type Result struct {
	Success int         `json:"success" example:"200"`
	Message string      `json:"message" example:"ok"`
	Data    interface{} `json:"data" example:"返回结果"`
}

公共返回模型

type SearchEngine added in v0.4.2

type SearchEngine struct {
	Name      string   `json:"name"`
	Icon      string   `json:"icon"`
	SearchUrl string   `json:"search_url"`
	RecoUrl   string   `json:"reco_url"`
	Data      []string `json:"data"`
}

type ServerModel

type ServerModel struct {
	HttpPort     string
	RunMode      string
	ServerApi    string
	LockAccount  bool
	Token        string
	USBAutoMount string
	UpdateUrl    string
}

服务配置

type SetPath added in v0.4.2

type SetPath interface {
	SetPath(path string)
}

type SettingItem added in v0.4.2

type SettingItem struct {
	Key     string `json:"key" gorm:"primaryKey" binding:"required"` // unique key
	Value   string `json:"value"`                                    // value
	Help    string `json:"help"`                                     // help message
	Type    string `json:"type"`                                     // string, number, bool, select
	Options string `json:"options"`                                  // values for select
	Group   int    `json:"group"`                                    // use to group setting in frontend
	Flag    int    `json:"flag"`                                     // 0 = public, 1 = private, 2 = readonly, 3 = deprecated, etc.
}

func (SettingItem) IsDeprecated added in v0.4.2

func (s SettingItem) IsDeprecated() bool

type Shares added in v0.3.5

type Shares struct {
	ID        uint   `json:"id"`
	Anonymous bool   `json:"anonymous"`
	Path      string `json:"path"`
}

type Sort added in v0.4.2

type Sort struct {
	OrderBy        string `json:"order_by"`
	OrderDirection string `json:"order_direction"`
	ExtractFolder  string `json:"extract_folder"`
}

type StorageA added in v0.4.3

type StorageA struct {
	ID              uint      `json:"id" gorm:"primaryKey"`                        // unique key
	MountPath       string    `json:"mount_path" gorm:"unique" binding:"required"` // must be standardized
	Order           int       `json:"order"`                                       // use to sort
	Driver          string    `json:"driver"`                                      // driver used
	CacheExpiration int       `json:"cache_expiration"`                            // cache expire time
	Status          string    `json:"status"`
	Addition        string    `json:"addition" gorm:"type:text"` // Additional information, defined in the corresponding driver
	Remark          string    `json:"remark"`
	Modified        time.Time `json:"modified"`
	Disabled        bool      `json:"disabled"` // if disabled
	Sort
	Proxy
}

func (*StorageA) GetStorage added in v0.4.3

func (s *StorageA) GetStorage() *StorageA

func (*StorageA) SetStatus added in v0.4.3

func (s *StorageA) SetStatus(status string)

func (*StorageA) SetStorage added in v0.4.3

func (s *StorageA) SetStorage(storage StorageA)

type SysInfoModel

type SysInfoModel struct {
	Name string // 系统名称
}

系统配置

type SystemConfig

type SystemConfig struct {
	ConfigPath string `json:"config_path"`
}

type Thumb added in v0.4.2

type Thumb interface {
	Thumb() string
}

type Thumbnail added in v0.4.2

type Thumbnail struct {
	Thumbnail string
}

func (Thumbnail) Thumb added in v0.4.2

func (t Thumbnail) Thumb() string

type URL added in v0.4.2

type URL interface {
	URL() string
}

type UnwrapObj added in v0.4.2

type UnwrapObj interface {
	Unwrap() Obj
}

type Url added in v0.4.2

type Url struct {
	Url string
}

func (Url) URL added in v0.4.2

func (w Url) URL() string

type UserInfo added in v0.3.0

type UserInfo struct {
	NickName string `json:"nick_name"`
	Desc     string `json:"desc"`
	ShareId  string `json:"share_id"`
	Avatar   string `json:"avatar"`
	Version  int    `json:"version,omitempty"`
}

type Version

type Version struct {
	Id        uint      `gorm:"column:id;primary_key" json:"id"`
	ChangeLog string    `json:"change_log"`
	Version   string    `json:"version"`
	CreatedAt time.Time `json:"created_at"`
	UpdatedAt time.Time `json:"updated_at"`
}

Directories

Path Synopsis
* @Author: LinkLeong link@icewhale.com * @Date: 2022-05-26 14:21:57 * @LastEditors: LinkLeong * @LastEditTime: 2022-06-02 11:14:15 * @FilePath: /CasaOS/model/notify/file.go * @Description: * @Website: https://www.casaos.io * Copyright (c) 2022 by icewhale, All Rights Reserved.
* @Author: LinkLeong link@icewhale.com * @Date: 2022-05-26 14:21:57 * @LastEditors: LinkLeong * @LastEditTime: 2022-06-02 11:14:15 * @FilePath: /CasaOS/model/notify/file.go * @Description: * @Website: https://www.casaos.io * Copyright (c) 2022 by icewhale, All Rights Reserved.
* @Author: LinkLeong link@icewhale.com * @Date: 2022-06-15 11:30:47 * @LastEditors: LinkLeong * @LastEditTime: 2022-06-23 18:40:40 * @FilePath: /CasaOS/model/system_model/verify_information.go * @Description: * @Website: https://www.casaos.io * Copyright (c) 2022 by icewhale, All Rights Reserved.
* @Author: LinkLeong link@icewhale.com * @Date: 2022-06-15 11:30:47 * @LastEditors: LinkLeong * @LastEditTime: 2022-06-23 18:40:40 * @FilePath: /CasaOS/model/system_model/verify_information.go * @Description: * @Website: https://www.casaos.io * Copyright (c) 2022 by icewhale, All Rights Reserved.

Jump to

Keyboard shortcuts

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