model

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2024 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

func ExtractFolder(objs []Obj, extractFolder string)

func GetThumb

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

func GetUrl

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

func SortFiles

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

func WrapObjsName

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

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

type CasaOSHeart

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

type CommonModel

type CommonModel struct {
	RuntimePath string
}

type Connections

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

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

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

type FileItem

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

type FileOperate

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

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

type FileStream

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

func (*FileStream) GetMimetype

func (f *FileStream) GetMimetype() string

func (*FileStream) GetOld

func (f *FileStream) GetOld() Obj

func (*FileStream) GetReadCloser

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

func (*FileStream) NeedStore

func (f *FileStream) NeedStore() bool

func (*FileStream) SetReadCloser

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

type FileStreamer

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

type FileUpdate

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

type FsOtherArgs

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

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

type ListArgs

type ListArgs struct {
	ReqPath string
}

type NotifyMssage

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

type Obj

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

func UnwrapObjs(obj Obj) Obj

func WrapObjName

func WrapObjName(objs Obj) Obj

Wrap

type ObjMerge

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

func NewObjMerge

func NewObjMerge() *ObjMerge

Merge

func (*ObjMerge) InitHideReg

func (om *ObjMerge) InitHideReg(hides string)

func (*ObjMerge) Merge

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

func (*ObjMerge) Reset

func (om *ObjMerge) Reset()

type ObjThumb

type ObjThumb struct {
	Object
	Thumbnail
}

type ObjThumbURL

type ObjThumbURL struct {
	Object
	Thumbnail
	Url
}

type ObjWrapName

type ObjWrapName struct {
	Name string
	Obj
}

func (*ObjWrapName) GetName

func (o *ObjWrapName) GetName() string

func (*ObjWrapName) Unwrap

func (o *ObjWrapName) Unwrap() Obj

type Object

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

func (*Object) GetID

func (o *Object) GetID() string

func (*Object) GetName

func (o *Object) GetName() string

func (*Object) GetPath

func (o *Object) GetPath() string

func (*Object) GetSize

func (o *Object) GetSize() int64

func (*Object) IsDir

func (o *Object) IsDir() bool

func (*Object) ModTime

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

func (*Object) SetPath

func (o *Object) SetPath(id string)

type ObjectURL

type ObjectURL struct {
	Object
	Url
}

type OtherArgs

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

type PageReq

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

func (*PageReq) Validate

func (p *PageReq) Validate()

type PageResp

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

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

func (Proxy) Webdav302

func (p Proxy) Webdav302() bool

func (Proxy) WebdavNative

func (p Proxy) WebdavNative() bool

func (Proxy) WebdavProxy

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

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

type SetPath interface {
	SetPath(path string)
}

type SettingItem

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

func (s SettingItem) IsDeprecated() bool

type Shares

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

type Sort

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

type StorageA

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

func (s *StorageA) GetStorage() *StorageA

func (*StorageA) SetStatus

func (s *StorageA) SetStatus(status string)

func (*StorageA) SetStorage

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

type Thumb interface {
	Thumb() string
}

type Thumbnail

type Thumbnail struct {
	Thumbnail string
}

func (Thumbnail) Thumb

func (t Thumbnail) Thumb() string

type URL

type URL interface {
	URL() string
}

type UnwrapObj

type UnwrapObj interface {
	Unwrap() Obj
}

type Url

type Url struct {
	Url string
}

func (Url) URL

func (w Url) URL() string

type UserInfo

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