model

package
v0.0.0-...-c590095 Latest Latest
Warning

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

Go to latest
Published: Mar 16, 2023 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNotFound = sqlx.ErrNotFound

Functions

This section is empty.

Types

type Proxy

type Proxy struct {
	WebProxy     bool   `json:"web_proxy" gorm:"not null"`
	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 Sort

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

type Storage

type Storage struct {
	ID              uint      `json:"id" gorm:"primaryKey"`                                 // unique key
	MountPath       string    `json:"mount_path" gorm:"unique;not null" binding:"required"` // must be standardized
	Order           int64     `json:"order" gorm:"not null"`                                // use to sort
	Driver          string    `json:"driver" gorm:"not null"`                               // driver used
	CacheExpiration int64     `json:"cache_expiration" gorm:"not null"`                     // cache expire time
	Status          string    `json:"status" gorm:"not null"`
	Addition        string    `json:"addition" gorm:"type:text;not null"` // Additional information, defined in the corresponding driver
	Remark          string    `json:"remark"`
	CreateTime      time.Time `json:"created_time"`
	UpdateTime      time.Time `json:"update_time"`
	Disabled        bool      `json:"disabled" gorm:"not null"` // if disabled
	Proxy
	ExtractFolder string `json:"extract_folder"`
}

func (*Storage) GetStorage

func (s *Storage) GetStorage() *Storage

func (*Storage) SetStatus

func (s *Storage) SetStatus(status string)

func (*Storage) SetStorage

func (s *Storage) SetStorage(storage Storage)

type Storages

type Storages struct {
	Id              int64          `db:"id"`
	MountPath       string         `db:"mount_path"`
	Order           int64          `db:"order"`
	Driver          string         `db:"driver"`
	CacheExpiration int64          `db:"cache_expiration"`
	Status          string         `db:"status"`
	Addition        string         `db:"addition"`
	Remark          sql.NullString `db:"remark"`
	CreateTime      time.Time      `db:"create_time"`
	UpdateTime      time.Time      `db:"update_time"`
	Disabled        bool           `db:"disabled"`
	WebProxy        bool           `db:"web_proxy"`
	WebdavPolicy    sql.NullString `db:"webdav_policy"`
	DownProxyUrl    sql.NullString `db:"down_proxy_url"`
	ExtractFolder   sql.NullString `db:"extract_folder"`
}

type StoragesModel

type StoragesModel interface {
	FindAllEnabled(ctx context.Context) ([]*Storages, error)
	FindAll(ctx context.Context) ([]*Storages, error)
	UpdataDisabled(ctx context.Context, id int64, disabled bool) error
	// contains filtered or unexported methods
}

StoragesModel is an interface to be customized, add more methods here, and implement the added methods in customStoragesModel.

func NewStoragesModel

func NewStoragesModel(conn sqlx.SqlConn, c cache.CacheConf) StoragesModel

NewStoragesModel returns a model for the database table.

Jump to

Keyboard shortcuts

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