Documentation ¶
Index ¶
- type Account
- type File
- type Folder
- type Repository
- type SQLiteRepository
- func (db *SQLiteRepository) AllFiles() ([]File, error)
- func (db *SQLiteRepository) ChangeAccount(id int64, user *Account) error
- func (db *SQLiteRepository) ChangeFile(file *File) error
- func (db *SQLiteRepository) ChangeFolder(folder *Folder) error
- func (db *SQLiteRepository) CreateAccount(email, name, password string) (*Account, error)
- func (db *SQLiteRepository) CreateFolder(folder *Folder) error
- func (db *SQLiteRepository) DeleteFile(file_id int64) error
- func (db *SQLiteRepository) DeleteFolder(folder_id int64) error
- func (db *SQLiteRepository) GetAccount(id int64) (*Account, error)
- func (db *SQLiteRepository) GetAccountByEmail(email string) (*Account, error)
- func (db *SQLiteRepository) GetFile(file_id int64) (*File, error)
- func (db *SQLiteRepository) GetFolder(folder_id int64) (*Folder, error)
- func (db *SQLiteRepository) Migrate() error
- func (db *SQLiteRepository) SaveFile(file *File) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Account ¶
type Account struct { ID int64 `json:"-" db:"id"` Email string `json:"email" db:"email"` Name string `json:"name" db:"name"` PasswordHash string `json:"-" db:"password_hash"` }
func (*Account) CheckPassword ¶
func (*Account) HashPassword ¶
type File ¶
type File struct { ID int64 `json:"id,omitempty" db:"id"` Name string `json:"name" db:"name"` MimeType string `json:"mime_type" db:"mime_type"` Size int64 `json:"size" db:"size"` SystemPath string `json:"system_path" db:"system_path"` FolderId int64 `json:"folder_id" db:"folder_id"` CreatedAt time.Time `json:"created_at,omitempty" db:"created_at"` }
func (*File) DownloadPath ¶
func (*File) FormatSize ¶
func (*File) FormatTime ¶
func (*File) PreviewPath ¶
type Repository ¶
type Repository interface { Migrate() error GetAccount(id int64) (*Account, error) GetAccountByEmail(email string) (*Account, error) CreateAccount(email, name, password string) (*Account, error) ChangeAccount(id int64, user *Account) error AllFiles() ([]File, error) SaveFile(file *File) error GetFile(file_id int64) (*File, error) DeleteFile(file_id int64) error ChangeFile(file *File) error GetFolder(folder_id int64) (*Folder, error) CreateFolder(folder *Folder) error ChangeFolder(folder *Folder) error DeleteFolder(folder_id int64) error }
type SQLiteRepository ¶
func InitSQLiteRepository ¶
func InitSQLiteRepository(db *sql.DB) *SQLiteRepository
func (*SQLiteRepository) AllFiles ¶
func (db *SQLiteRepository) AllFiles() ([]File, error)
func (*SQLiteRepository) ChangeAccount ¶
func (db *SQLiteRepository) ChangeAccount(id int64, user *Account) error
func (*SQLiteRepository) ChangeFile ¶
func (db *SQLiteRepository) ChangeFile(file *File) error
"move" file from folder or IN folder is the same as ChangeFile. So it's unnececery to create separate handlers
func (*SQLiteRepository) ChangeFolder ¶
func (db *SQLiteRepository) ChangeFolder(folder *Folder) error
func (*SQLiteRepository) CreateAccount ¶
func (db *SQLiteRepository) CreateAccount(email, name, password string) (*Account, error)
func (*SQLiteRepository) CreateFolder ¶
func (db *SQLiteRepository) CreateFolder(folder *Folder) error
func (*SQLiteRepository) DeleteFile ¶
func (db *SQLiteRepository) DeleteFile(file_id int64) error
func (*SQLiteRepository) DeleteFolder ¶
func (db *SQLiteRepository) DeleteFolder(folder_id int64) error
func (*SQLiteRepository) GetAccount ¶
func (db *SQLiteRepository) GetAccount(id int64) (*Account, error)
func (*SQLiteRepository) GetAccountByEmail ¶
func (db *SQLiteRepository) GetAccountByEmail(email string) (*Account, error)
func (*SQLiteRepository) GetFile ¶
func (db *SQLiteRepository) GetFile(file_id int64) (*File, error)
func (*SQLiteRepository) GetFolder ¶
func (db *SQLiteRepository) GetFolder(folder_id int64) (*Folder, error)
func (*SQLiteRepository) Migrate ¶
func (db *SQLiteRepository) Migrate() error
func (*SQLiteRepository) SaveFile ¶
func (db *SQLiteRepository) SaveFile(file *File) error
Click to show internal directories.
Click to hide internal directories.