Documentation ¶
Index ¶
- Constants
- Variables
- func Tables() []interface{}
- type Matter
- type MatterEnv
- type Option
- type Opts
- func (m Opts) GetBool(name string) bool
- func (m Opts) GetInt(name string) int
- func (m Opts) GetString(name string) string
- func (Opts) GormDBDataType(db *gorm.DB, field *schema.Field) string
- func (m Opts) GormDataType() string
- func (m Opts) MarshalJSON() ([]byte, error)
- func (m *Opts) Scan(val interface{}) error
- func (m *Opts) UnmarshalJSON(b []byte) error
- func (m Opts) Value() (driver.Value, error)
- type Recycle
- type Share
- type Storage
- type User
- type UserCreateOption
- type UserProfile
- type UserStorage
Constants ¶
View Source
const ( DirTypeSys = iota + 1 DirTypeUser DirFileMaxNum = 65534 )
View Source
const ( OptSite = "core.site" OptEmail = "core.email" )
View Source
const ( StorageModeNetDisk = iota + 1 StorageModeFileDisk )
View Source
const ( RoleAdmin = "admin" RoleMember = "member" RoleGuest = "guest" )
View Source
const ( StatusInactivated = iota StatusActivated StatusDisabled )
View Source
const ( UserStorageDefaultSize = 50 << 20 UserStorageActiveSize = 1024 << 20 )
Variables ¶
View Source
var ( DefaultSiteOpts = Opts{"name": "ZPan", "intro": "您的私有网盘专家", "locale": "zh-CN", "invite_required": true} DefaultEmailOpts = Opts{"address": "smtpdm.aliyun.com:25", "username": "no-reply@saltbo.fun", "password": "yourpassword", "sender": "ZPan"} )
View Source
var DocTypes = []string{
"text/csv",
"application/msword",
"application/vnd.ms-excel",
"application/vnd.ms-powerpoint",
"application/vnd.openxmlformats-officedocument.wordprocessingml.document",
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
"application/vnd.openxmlformats-officedocument.presentationml.presentation",
}
View Source
var SupportEnvs = []MatterEnv{ {Name: "$UID", Intro: "用户ID", Example: "10001", /* contains filtered or unexported fields */}, {Name: "$UUID", Intro: "UUID", Example: "6ba7b810-9dad-11d1-80b4-00c04fd430c8", /* contains filtered or unexported fields */}, {Name: "$RAW_PATH", Intro: "初始上传路径", Example: "文稿/简历", /* contains filtered or unexported fields */}, {Name: "$RAW_NAME", Intro: "初始文件名", Example: "张三-简历", /* contains filtered or unexported fields */}, {Name: "$RAW_EXT", Intro: "初始文件后缀", Example: "pdf", /* contains filtered or unexported fields */}, {Name: "$RAND_8KEY", Intro: "8位随机字符", Example: "mCUoR35r", /* contains filtered or unexported fields */}, {Name: "$RAND_16KEY", Intro: "16位随机字符", Example: "e1CbDUNfyVP3sScJ", /* contains filtered or unexported fields */}, {Name: "$NOW_DATE", Intro: "当前时间-日期", Example: "20210101", /* contains filtered or unexported fields */}, {Name: "$NOW_YEAR", Intro: "当前时间-年", Example: "2021", /* contains filtered or unexported fields */}, {Name: "$NOW_MONTH", Intro: "当前时间-月", Example: "01", /* contains filtered or unexported fields */}, {Name: "$NOW_DAY", Intro: "当前时间-日", Example: "01", /* contains filtered or unexported fields */}, {Name: "$NOW_HOUR", Intro: "当前时间-时", Example: "12", /* contains filtered or unexported fields */}, {Name: "$NOW_MIN", Intro: "当前时间-分", Example: "30", /* contains filtered or unexported fields */}, {Name: "$NOW_SEC", Intro: "当前时间-秒", Example: "10", /* contains filtered or unexported fields */}, {Name: "$NOW_UNIX", Intro: "当前时间-时间戳", Example: "1612631185", /* contains filtered or unexported fields */}, }
Functions ¶
Types ¶
type Matter ¶
type Matter struct { Id int64 `json:"id"` Uid int64 `json:"uid" gorm:"not null"` Sid int64 `json:"sid" gorm:"not null"` // storage_id Alias string `json:"alias" gorm:"size:16;not null"` Name string `json:"name" gorm:"not null"` Type string `json:"type" gorm:"not null"` Size int64 `json:"size" gorm:"not null"` DirType int8 `json:"dirtype" gorm:"column:dirtype;not null"` Parent string `json:"parent" gorm:"not null"` Object string `json:"object" gorm:"not null"` URL string `json:"url" gorm:"-"` CreatedAt time.Time `json:"created" gorm:"not null"` UpdatedAt time.Time `json:"updated" gorm:"not null"` UploadedAt *time.Time `json:"uploaded"` DeletedAt gorm.DeletedAt `json:"-"` TrashedBy string `json:"-" gorm:"size:16;not null"` }
func (*Matter) BuildObject ¶
func (*Matter) UserAccessible ¶
type Option ¶
type Opts ¶
type Opts map[string]interface{}
Opts defiend JSON data type, need to implements driver.Valuer, sql.Scanner interface
func (Opts) GormDBDataType ¶
GormDBDataType gorm db data type
func (Opts) MarshalJSON ¶
MarshalJSON to output non base64 encoded []byte
func (*Opts) UnmarshalJSON ¶
UnmarshalJSON to deserialize []byte
type Recycle ¶
type Recycle struct { Id int64 `json:"id"` Uid int64 `json:"uid" gorm:"not null"` Sid int64 `json:"sid" gorm:"not null"` // storage_id Alias string `json:"alias" gorm:"size:16;not null"` Name string `json:"name" gorm:"not null"` Type string `json:"type" gorm:"not null"` Size int64 `json:"size" gorm:"not null"` DirType int8 `json:"dirtype" gorm:"column:dirtype;not null"` Parent string `json:"parent" gorm:"not null"` Object string `json:"object" gorm:"not null"` CreatedAt time.Time `json:"created" gorm:"not null"` DeletedAt *time.Time `json:"deleted"` }
func (*Recycle) UserAccessible ¶
type Storage ¶
type Storage struct { Id int64 `json:"id"` Mode int8 `json:"mode" gorm:"size:16;not null"` Name string `json:"name" gorm:"size:16;not null"` Title string `json:"title" gorm:"size:16;not null"` IDirs string `json:"idirs" gorm:"size:255;not null"` // internal dirs Bucket string `json:"bucket" gorm:"size:32;not null"` Provider string `json:"provider" gorm:"size:8;not null"` Endpoint string `json:"endpoint" gorm:"size:128;not null"` AccessKey string `json:"access_key" gorm:"size:64;not null"` SecretKey string `json:"secret_key" gorm:"size:64;not null"` CustomHost string `json:"custom_host" gorm:"size:128;not null"` RootPath string `json:"root_path" gorm:"size:64;not null"` FilePath string `json:"file_path" gorm:"size:1024;not null"` Created time.Time `json:"created" gorm:"autoCreateTime;not null"` Updated time.Time `json:"updated" gorm:"autoUpdateTime;not null"` Deleted gorm.DeletedAt `json:"-"` }
func (*Storage) PublicRead ¶
func (*Storage) SKAsterisk ¶
type User ¶
type User struct { Id int64 `json:"id"` Email string `json:"email" gorm:"size:32;unique_index;not null"` Username string `json:"username" gorm:"size:20;unique_index;not null"` Password string `json:"-" gorm:"size:32;not null"` Status uint8 `json:"-" gorm:"size:1;not null"` StatusTxt string `json:"status" gorm:"-"` Roles string `json:"-" gorm:"size:64;not null"` RoleTxt string `json:"role" gorm:"-"` Ticket string `json:"ticket" gorm:"size:6;unique_index;not null"` Profile UserProfile `json:"profile,omitempty" gorm:"foreignKey:Uid"` Storage UserStorage `json:"storage,omitempty" gorm:"foreignKey:Uid"` Created time.Time `json:"created" gorm:"autoCreateTime;not null"` Updated time.Time `json:"updated" gorm:"autoUpdateTime;not null"` Deleted gorm.DeletedAt `json:"-"` Token string `json:"-" gorm:"-"` }
func (*User) RolesSplit ¶
type UserCreateOption ¶
type UserCreateOption struct { Roles string Ticket string Origin string Activated bool StorageMax uint64 }
func NewUserCreateOption ¶
func NewUserCreateOption() UserCreateOption
type UserProfile ¶
type UserProfile struct { Id int64 `json:"id"` Uid int64 `json:"uid" gorm:"unique_index;not null"` Nickname string `json:"nickname" gorm:"size:32;not null"` Avatar string `json:"avatar" gorm:"size:255;not null"` Bio string `json:"bio" gorm:"size:255;not null"` URL string `json:"url" gorm:"size:255;not null"` Company string `json:"company" gorm:"size:32;not null"` Location string `json:"location" gorm:"size:32;not null"` Locale string `json:"locale" gorm:"not null"` Created time.Time `json:"created" gorm:"autoCreateTime;not null"` Updated time.Time `json:"updated" gorm:"autoUpdateTime;not null"` Deleted gorm.DeletedAt `json:"-"` }
func (UserProfile) TableName ¶
func (UserProfile) TableName() string
type UserStorage ¶
type UserStorage struct { Id int64 `json:"id"` Uid int64 `json:"uid" gorm:"not null"` Max uint64 `json:"max" gorm:"not null"` Used uint64 `json:"used" gorm:"not null"` Created time.Time `json:"created" gorm:"autoCreateTime;not null"` Updated time.Time `json:"updated" gorm:"autoUpdateTime;not null"` Deleted gorm.DeletedAt `json:"-"` }
func (*UserStorage) Overflowed ¶
func (sq *UserStorage) Overflowed(addonSize int64) bool
func (UserStorage) TableName ¶
func (UserStorage) TableName() string
Click to show internal directories.
Click to hide internal directories.