Documentation ¶
Index ¶
- Constants
- Variables
- func NewRememberToken() (string, error)
- type File
- type Filter
- type Folder
- type Pagination
- func (p *Pagination) CurrentPage() int
- func (p *Pagination) EndOfPage() int
- func (p *Pagination) Filter(name string) (Filter, bool)
- func (p *Pagination) FilterValue(name string) string
- func (p *Pagination) Limit() int
- func (p *Pagination) NumberOfPages() int
- func (p *Pagination) Offset() int
- func (p *Pagination) PageOffset(page int) int
- func (p *Pagination) PaginationString() string
- func (p *Pagination) SetTotal(total int)
- func (p *Pagination) Sort() string
- func (p *Pagination) StartOfPage() int
- func (p *Pagination) ToPairs() []string
- func (p *Pagination) Total() int
- func (p *Pagination) VisiblePages() []int
- type Permissions
- type Space
- type User
Constants ¶
View Source
const PostponePeriod = 30 * 24 * time.Hour
Variables ¶
View Source
var ErrNotFound = errors.New("not found")
Functions ¶
func NewRememberToken ¶ added in v1.1.0
Types ¶
type File ¶
type File struct { ID string `json:"id,omitempty"` FolderID string `json:"folder_id,omitempty"` MD5 string `json:"md5,omitempty"` Name string `json:"name,omitempty"` Size int64 `json:"size,omitempty"` ContentType string `json:"content_type,omitempty"` Downloads int64 `json:"downloads,omitempty"` CreatedAt time.Time `json:"created_at,omitempty"` UpdatedAt time.Time `json:"updated_at,omitempty"` // relations (can be empty) Folder *Folder `json:"folder,omitempty"` }
type Folder ¶
type Folder struct { ID string `json:"id,omitempty"` SpaceID string `json:"space_id,omitempty"` Name string `json:"name,omitempty"` CreatedAt time.Time `json:"created_at,omitempty"` UpdatedAt time.Time `json:"updated_at,omitempty"` ExpiresAt time.Time `json:"expires_at,omitempty"` // relations (can be empty) Space *Space `json:"space,omitempty"` Files []*File `json:"files,omitempty"` }
func (*Folder) PostponeExpiration ¶ added in v1.1.4
func (*Folder) TotalDownloads ¶ added in v1.1.0
type Pagination ¶ added in v1.1.4
type Pagination struct {
// contains filtered or unexported fields
}
func NewPagination ¶ added in v1.1.4
func NewPagination(offset int, limit int, sort string, filters ...Filter) *Pagination
func (*Pagination) CurrentPage ¶ added in v1.1.4
func (p *Pagination) CurrentPage() int
func (*Pagination) EndOfPage ¶ added in v1.1.4
func (p *Pagination) EndOfPage() int
func (*Pagination) FilterValue ¶ added in v1.1.4
func (p *Pagination) FilterValue(name string) string
func (*Pagination) Limit ¶ added in v1.1.4
func (p *Pagination) Limit() int
func (*Pagination) NumberOfPages ¶ added in v1.1.4
func (p *Pagination) NumberOfPages() int
func (*Pagination) Offset ¶ added in v1.1.4
func (p *Pagination) Offset() int
func (*Pagination) PageOffset ¶ added in v1.1.4
func (p *Pagination) PageOffset(page int) int
func (*Pagination) PaginationString ¶ added in v1.1.4
func (p *Pagination) PaginationString() string
func (*Pagination) SetTotal ¶ added in v1.1.4
func (p *Pagination) SetTotal(total int)
func (*Pagination) Sort ¶ added in v1.1.4
func (p *Pagination) Sort() string
func (*Pagination) StartOfPage ¶ added in v1.1.4
func (p *Pagination) StartOfPage() int
func (*Pagination) ToPairs ¶ added in v1.1.4
func (p *Pagination) ToPairs() []string
func (*Pagination) Total ¶ added in v1.1.4
func (p *Pagination) Total() int
func (*Pagination) VisiblePages ¶ added in v1.1.4
func (p *Pagination) VisiblePages() []int
type Permissions ¶
type Permissions struct {
Admins []string
}
func (*Permissions) IsAdmin ¶
func (p *Permissions) IsAdmin(user *User) bool
func (*Permissions) IsSpaceAdmin ¶
func (p *Permissions) IsSpaceAdmin(user *User, space *Space) bool
type Space ¶
type Space struct { ID string `json:"id,omitempty"` Name string `json:"name,omitempty"` Admins []string `json:"admins,omitempty"` CreatedAt time.Time `json:"created_at,omitempty"` UpdatedAt time.Time `json:"updated_at,omitempty"` // relations (can be empty) Folders []*Folder `json:"folders,omitempty"` }
type User ¶
type User struct { ID string `json:"id,omitempty"` Username string `json:"username,omitempty"` Name string `json:"name,omitempty"` Email string `json:"email,omitempty"` RememberToken string `json:"remember_token,omitempty"` CreatedAt time.Time `json:"created_at,omitempty"` UpdatedAt time.Time `json:"updated_at,omitempty"` }
Click to show internal directories.
Click to hide internal directories.