db

package
v0.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 9, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

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 File

type File struct {
	ID          string
	Path        string
	FileHash    string
	FileName    string
	Description sql.NullString
	Size        int64
	CreatedAt   sql.NullTime
}

type FileStat

type FileStat struct {
	ID               string
	FileID           string
	DownloadCount    sql.NullInt64
	LastDownloadedAt sql.NullTime
}

type GetAllFilesRow

type GetAllFilesRow struct {
	ID          string
	Path        string
	FileName    string
	Description sql.NullString
	Size        int64
	CreatedAt   sql.NullTime
}

type GetFileByHashRow

type GetFileByHashRow struct {
	ID       string
	Path     string
	FileName string
}

type GetFileByIDRow

type GetFileByIDRow struct {
	ID          string
	FileName    string
	Path        string
	Description sql.NullString
	Size        int64
	CreatedAt   sql.NullTime
}

type InsertFileParams

type InsertFileParams struct {
	ID          string
	FileName    string
	FileHash    string
	Path        string
	Description sql.NullString
	Size        int64
}

type InsertFileRow

type InsertFileRow struct {
	ID        string
	CreatedAt sql.NullTime
}

type InsertPermissionParams

type InsertPermissionParams struct {
	ID             string
	FileID         string
	PermissionType string
}

type InsertPermissionRow

type InsertPermissionRow struct {
	ID        string
	GrantedAt sql.NullTime
}

type InsertTemporaryLinkParams

type InsertTemporaryLinkParams struct {
	ID        string
	FileID    string
	Token     string
	ExpiresAt time.Time
}

type InsertTemporaryLinkRow

type InsertTemporaryLinkRow struct {
	ID        string
	Token     string
	CreatedAt sql.NullTime
	ExpiresAt time.Time
}

type Permission

type Permission struct {
	ID             string
	FileID         string
	PermissionType string
	GrantedAt      sql.NullTime
}

type Queries

type Queries struct {
	// contains filtered or unexported fields
}

func New

func New(db DBTX) *Queries
func (q *Queries) DeleteExpiredLinks(ctx context.Context) error

func (*Queries) DeleteFile

func (q *Queries) DeleteFile(ctx context.Context, id string) (string, error)

func (*Queries) DeleteFilePermissions

func (q *Queries) DeleteFilePermissions(ctx context.Context, fileID string) error

func (*Queries) GetAllFiles

func (q *Queries) GetAllFiles(ctx context.Context) ([]GetAllFilesRow, error)

func (*Queries) GetFileByHash

func (q *Queries) GetFileByHash(ctx context.Context, fileHash string) (GetFileByHashRow, error)

func (*Queries) GetFileByID

func (q *Queries) GetFileByID(ctx context.Context, id string) (GetFileByIDRow, error)

func (*Queries) GetFilePermissions

func (q *Queries) GetFilePermissions(ctx context.Context, fileID string) ([]Permission, error)

func (*Queries) GetFileStats

func (q *Queries) GetFileStats(ctx context.Context, fileID string) (FileStat, error)

func (*Queries) GetTemporaryLinkByToken

func (q *Queries) GetTemporaryLinkByToken(ctx context.Context, token string) (TemporaryLink, error)

func (*Queries) InsertFile

func (q *Queries) InsertFile(ctx context.Context, arg InsertFileParams) (InsertFileRow, error)

func (*Queries) InsertPermission

func (q *Queries) InsertPermission(ctx context.Context, arg InsertPermissionParams) (InsertPermissionRow, error)
func (q *Queries) InsertTemporaryLink(ctx context.Context, arg InsertTemporaryLinkParams) (InsertTemporaryLinkRow, error)

func (*Queries) UpdateFileDescription

func (q *Queries) UpdateFileDescription(ctx context.Context, arg UpdateFileDescriptionParams) (UpdateFileDescriptionRow, error)

func (*Queries) UpsertFileStats

func (q *Queries) UpsertFileStats(ctx context.Context, arg UpsertFileStatsParams) (UpsertFileStatsRow, error)

func (*Queries) WithTx

func (q *Queries) WithTx(tx *sql.Tx) *Queries
type TemporaryLink struct {
	ID        string
	FileID    string
	Token     string
	CreatedAt sql.NullTime
	ExpiresAt time.Time
}

type UpdateFileDescriptionParams

type UpdateFileDescriptionParams struct {
	Description sql.NullString
	ID          string
}

type UpdateFileDescriptionRow

type UpdateFileDescriptionRow struct {
	ID          string
	Description sql.NullString
}

type UpsertFileStatsParams

type UpsertFileStatsParams struct {
	ID               string
	FileID           string
	DownloadCount    sql.NullInt64
	LastDownloadedAt sql.NullTime
}

type UpsertFileStatsRow

type UpsertFileStatsRow struct {
	ID               string
	DownloadCount    sql.NullInt64
	LastDownloadedAt sql.NullTime
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL