package sqlite
import "hauru.club/x/okrzeja/storage/sqlite"
Package sqlite implements storage interface for embedded sqlite3 database.
Index ¶
- Constants
- func Migrate(db *sql.DB) error
- type Activity
- type Admin
- type Config
- type CreateNewFileParams
- type CreateNewUserParams
- type CreateRoleParams
- type Csrf
- type DBTX
- type Filesystem
- type PushConfigParams
- type Queries
- func New(db DBTX) *Queries
- func (q *Queries) CountAdmins(ctx context.Context) (int64, error)
- func (q *Queries) CountAllFiles(ctx context.Context) (int64, error)
- func (q *Queries) CountUsersSessions(ctx context.Context, username string) (int64, error)
- func (q *Queries) CreateNewFile(ctx context.Context, arg CreateNewFileParams) (Filesystem, error)
- func (q *Queries) CreateNewUser(ctx context.Context, arg CreateNewUserParams) (User, error)
- func (q *Queries) CreateRole(ctx context.Context, arg CreateRoleParams) (Role, error)
- func (q *Queries) DeleteDanglingFiles(ctx context.Context) error
- func (q *Queries) DeleteDeadRoles(ctx context.Context, resourceName string) error
- func (q *Queries) DeleteFile(ctx context.Context, id string) (Filesystem, error)
- func (q *Queries) DeleteSession(ctx context.Context, id string) (Session, error)
- func (q *Queries) DeleteUser(ctx context.Context, id string) error
- func (q *Queries) MakeAdminNow(ctx context.Context, id string) (Admin, error)
- func (q *Queries) PushConfig(ctx context.Context, arg PushConfigParams) (Config, error)
- func (q *Queries) ReadAdminUsernames(ctx context.Context) ([]string, error)
- func (q *Queries) ReadFile(ctx context.Context, id string) (Filesystem, error)
- func (q *Queries) ReadFilesFromDirectory(ctx context.Context, parent sql.NullString) ([]Filesystem, error)
- func (q *Queries) ReadIsAdmin(ctx context.Context, id string) (bool, error)
- func (q *Queries) ReadLatestConfig(ctx context.Context) (Config, error)
- func (q *Queries) ReadRolesOfUserForResource(ctx context.Context, arg ReadRolesOfUserForResourceParams) ([]string, error)
- func (q *Queries) ReadSession(ctx context.Context, id string) (ReadSessionRow, error)
- func (q *Queries) ReadUser(ctx context.Context, id string) (User, error)
- func (q *Queries) ReadUserByUsername(ctx context.Context, lower string) (User, error)
- func (q *Queries) ReadUserFile(ctx context.Context, req ReadUserFileRequest) (ReadUserFileResponse, error)
- func (q *Queries) ReadUserRoles(ctx context.Context, arg ReadUserRolesParams) ([]Role, error)
- func (q *Queries) SearchUsersByUsername(ctx context.Context, arg SearchUsersByUsernameParams) ([]User, error)
- func (q *Queries) UpdateFileContent(ctx context.Context, arg UpdateFileContentParams) error
- func (q *Queries) UpdateFileName(ctx context.Context, arg UpdateFileNameParams) error
- func (q *Queries) UpdateModTimeNow(ctx context.Context, id string) error
- func (q *Queries) UpdateUserPassword(ctx context.Context, arg UpdateUserPasswordParams) error
- func (q *Queries) WithTx(tx *sql.Tx) *Queries
- func (q *Queries) WriteSession(ctx context.Context, arg WriteSessionParams) (Session, error)
- type ReadRolesOfUserForResourceParams
- type ReadSessionRow
- type ReadUserFileRequest
- type ReadUserFileResponse
- type ReadUserRolesParams
- type Role
- type SearchUsersByUsernameParams
- type Session
- type UpdateFileContentParams
- type UpdateFileNameParams
- type UpdateUserPasswordParams
- type User
- type UsersOwnershipFix
- type Var
- type Void
- type WriteSessionParams
Constants ¶
const TimeLayout = "2006-01-02 15:04:05.999"
TimeLayout is sqlite time format used for default time values. SQLite always uses UTC time zone.
Functions ¶
func Migrate ¶
Types ¶
type Activity ¶
type Admin ¶
type Config ¶
type CreateNewFileParams ¶
type CreateNewFileParams struct { ID string Parent sql.NullString Name string Content []byte Mime string }
type CreateNewUserParams ¶
type CreateRoleParams ¶
type Csrf ¶
type DBTX ¶
type DBTX interface { ExecContext(context.Context, string, ...interface{}) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) QueryRowContext(context.Context, string, ...interface{}) *sql.Row }
type Filesystem ¶
type Filesystem struct { ID string Parent sql.NullString Name string Content []byte CreatedAt string LastUpdatedAt string Mime string }
type PushConfigParams ¶
type Queries ¶
type Queries struct {
// contains filtered or unexported fields
}
func New ¶
func (*Queries) CountAdmins ¶
func (*Queries) CountAllFiles ¶
func (*Queries) CountUsersSessions ¶
func (*Queries) CreateNewFile ¶
func (q *Queries) CreateNewFile(ctx context.Context, arg CreateNewFileParams) (Filesystem, error)
func (*Queries) CreateNewUser ¶
func (*Queries) CreateRole ¶
func (*Queries) DeleteDanglingFiles ¶
func (*Queries) DeleteDeadRoles ¶
func (*Queries) DeleteFile ¶
func (*Queries) DeleteSession ¶
func (*Queries) DeleteUser ¶
func (*Queries) MakeAdminNow ¶
func (*Queries) PushConfig ¶
func (*Queries) ReadAdminUsernames ¶
func (*Queries) ReadFile ¶
func (*Queries) ReadFilesFromDirectory ¶
func (q *Queries) ReadFilesFromDirectory(ctx context.Context, parent sql.NullString) ([]Filesystem, error)
func (*Queries) ReadIsAdmin ¶
func (*Queries) ReadLatestConfig ¶
func (*Queries) ReadRolesOfUserForResource ¶
func (q *Queries) ReadRolesOfUserForResource(ctx context.Context, arg ReadRolesOfUserForResourceParams) ([]string, error)
func (*Queries) ReadSession ¶
func (*Queries) ReadUser ¶
func (*Queries) ReadUserByUsername ¶
func (*Queries) ReadUserFile ¶
func (q *Queries) ReadUserFile(ctx context.Context, req ReadUserFileRequest) (ReadUserFileResponse, error)
ReadUserFile returns file data of file owned by user with given username.
func (*Queries) ReadUserRoles ¶
func (*Queries) SearchUsersByUsername ¶
func (q *Queries) SearchUsersByUsername(ctx context.Context, arg SearchUsersByUsernameParams) ([]User, error)
func (*Queries) UpdateFileContent ¶
func (q *Queries) UpdateFileContent(ctx context.Context, arg UpdateFileContentParams) error
func (*Queries) UpdateFileName ¶
func (q *Queries) UpdateFileName(ctx context.Context, arg UpdateFileNameParams) error
func (*Queries) UpdateModTimeNow ¶
func (*Queries) UpdateUserPassword ¶
func (q *Queries) UpdateUserPassword(ctx context.Context, arg UpdateUserPasswordParams) error
func (*Queries) WithTx ¶
func (*Queries) WriteSession ¶
type ReadRolesOfUserForResourceParams ¶
type ReadRolesOfUserForResourceParams struct { UserID string ResourceName string ResourceID string }
type ReadSessionRow ¶
type ReadSessionRow struct { ID string CreatedAt string Ttl int64 OwnerID string OwnerUsername string }
type ReadUserFileRequest ¶
ReadUserFileRequest contains arguments for requesting single file reequest.
type ReadUserFileResponse ¶
type ReadUserFileResponse struct { ID string Parent sql.NullString Name string Content []byte CreatedAt string LastUpdatedAt string MIME string Path string }
ReadUserFileResponse contains fields related to single file stored in the filesystem table.
type ReadUserRolesParams ¶
type Role ¶
type SearchUsersByUsernameParams ¶
type Session ¶
type UpdateFileContentParams ¶
type UpdateFileNameParams ¶
type UpdateUserPasswordParams ¶
type User ¶
type User struct { ID string Username string Password []byte CreatedAt string LastUpdatedAt string }
type UsersOwnershipFix ¶
type UsersOwnershipFix struct { UserID string }
type Var ¶
type Var struct { Key string Value sql.NullString }
type Void ¶
type WriteSessionParams ¶
Source Files ¶
admin.sql.gen.go config.sql.gen.go db.gen.go fileserver.go fileserver.sql.gen.go models.gen.go roles.sql.gen.go sessions.sql.gen.go sqlite.go users.sql.gen.go
- Version
- v0.0.0-20231010043146-4292577f982b (latest)
- Published
- Oct 10, 2023
- Platform
- linux/amd64
- Imports
- 6 packages
- Last checked
- 1 day ago –
Tools for package owners.