Documentation
¶
Index ¶
- Variables
- type File
- type FileModel
- func (p FileModel) Add(ctx context.Context, item *File) error
- func (p FileModel) CheckIfExists(ctx context.Context, name string) (bool, error)
- func (p FileModel) Delete(ctx context.Context, name, userID string) (int, error)
- func (p FileModel) Get(ctx context.Context, name string) (File, error)
- func (p FileModel) GetAll(ctx context.Context, userID, pageID, limit int, orderAsc bool) ([]File, error)
- func (p FileModel) GetEveryFile(ctx context.Context, pageID, limit int) ([]File, error)
- func (p FileModel) GetWithAuth(ctx context.Context, name, userID string) (File, error)
- func (p FileModel) PostUploadFileUpdate(ctx context.Context, userID int, name, contentType string) error
- func (p FileModel) UpdateContentType(ctx context.Context, name, contentType string) error
- type FileModelInterface
- type Models
- type PgxIface
- type User
- type UserModel
- func (m UserModel) Add(ctx context.Context, user User) error
- func (m UserModel) Authenticate(ctx context.Context, u User) (User, error)
- func (m UserModel) Delete(ctx context.Context, userID int) (int, error)
- func (m UserModel) Get(ctx context.Context, userID int) (User, error)
- func (m UserModel) GetAll(ctx context.Context) ([]User, error)
- func (m UserModel) Search(ctx context.Context, username string) (User, error)
- func (m UserModel) Update(ctx context.Context, userID int, u User) error
- func (m UserModel) UpdateSelf(ctx context.Context, userID int, u User) error
- type UserModelInterface
Constants ¶
This section is empty.
Variables ¶
Functions ¶
This section is empty.
Types ¶
type File ¶
type File struct {
ID int `json:"id"`
Name string `json:"name"`
SubmitterIP netip.Addr `json:"submitter_ip"`
SubmitterID int `json:"submitter_id"`
IsUploaded bool `json:"is_uploaded"`
ContentType string `json:"content_type"`
UploadDate time.Time `json:"upload_date"`
}
func (*File) IsCorrectlyInitialized ¶
type FileModel ¶
type FileModel struct {
DB PgxIface
FileModelInterface
}
func (FileModel) CheckIfExists ¶
func (FileModel) GetAll ¶
func (p FileModel) GetAll(ctx context.Context, userID, pageID, limit int, orderAsc bool) ([]File, error)
GetAll returns all files for userID but without content. Now with pagination!
func (FileModel) GetEveryFile ¶
func (FileModel) GetWithAuth ¶
func (FileModel) PostUploadFileUpdate ¶
type FileModelInterface ¶
type User ¶
type User struct {
ID int `json:"id"`
Name string `json:"name"`
Email string `json:"email"`
Password string `json:"password"`
IsAdmin bool `json:"is_admin"`
}
func (User) HasLoginCredentials ¶
func (User) IsCorrectlyInitialized ¶
type UserModel ¶
type UserModel struct {
DB PgxIface
UserModelInterface
}
func (UserModel) Authenticate ¶
Authenticate returns true if credentials correct.
type UserModelInterface ¶
type UserModelInterface interface {
Add(ctx context.Context, u User) error
Get(ctx context.Context, name string) (User, error)
GetAll(ctx context.Context) ([]User, error)
Delete(ctx context.Context, name string) error
Update(ctx context.Context, name string, u User) error
Authenticate(ctx context.Context, u User) (User, error)
}
Click to show internal directories.
Click to hide internal directories.