db

package
v0.0.0-...-df34f37 Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Account

type Account struct {
	AccountID      uuid.UUID `json:"account_id"`
	Username       string    `json:"username"`
	Password       string    `json:"password"`
	RegisterDate   time.Time `json:"register_date"`
	LastLogin      time.Time `json:"last_login"`
	ActivityPoints int32     `json:"activity_points"`
}

type AccountSession

type AccountSession struct {
	SessionID  string    `json:"session_id"`
	AccountID  uuid.UUID `json:"account_id"`
	StartDate  time.Time `json:"start_date"`
	ExpireDate time.Time `json:"expire_date"`
	TokenType  TokenType `json:"token_type"`
}

type DBTX

type DBTX interface {
	Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error)
	Query(context.Context, string, ...interface{}) (pgx.Rows, error)
	QueryRow(context.Context, string, ...interface{}) pgx.Row
}

type DeleteSessionParams

type DeleteSessionParams struct {
	SessionID   string `json:"session_id"`
	SessionID_2 string `json:"session_id_2"`
}

type Feedback

type Feedback struct {
	ID      int32          `json:"id"`
	Comment sql.NullString `json:"comment"`
	Boxes   string         `json:"boxes"`
}

type File

type File struct {
	FileUuid     string         `json:"file_uuid"`
	Title        sql.NullString `json:"title"`
	Passwdhash   sql.NullString `json:"passwdhash"`
	AccessToken  string         `json:"access_token"`
	Encrypted    bool           `json:"encrypted"`
	FileSize     int32          `json:"file_size"`
	EncryptionIv []byte         `json:"encryption_iv"`
	UploadDate   time.Time      `json:"upload_date"`
	LastSeen     time.Time      `json:"last_seen"`
	Viewcount    int32          `json:"viewcount"`
	FileHash     string         `json:"file_hash"`
}

type FileToAccount

type FileToAccount struct {
	AccountID uuid.UUID `json:"account_id"`
	FileUuid  string    `json:"file_uuid"`
}

type FileToAccountParams

type FileToAccountParams struct {
	FileUuid  string `json:"file_uuid"`
	SessionID string `json:"session_id"`
}

type GetFeedbacksRow

type GetFeedbacksRow struct {
	Comment sql.NullString `json:"comment"`
	Boxes   string         `json:"boxes"`
}

type GetFileInformationRow

type GetFileInformationRow struct {
	FileUuid   string         `json:"file_uuid"`
	Title      sql.NullString `json:"title"`
	UploadDate time.Time      `json:"upload_date"`
	FileHash   string         `json:"file_hash"`
	Encrypted  bool           `json:"encrypted"`
	FileSize   int32          `json:"file_size"`
	Viewcount  int32          `json:"viewcount"`
}

type GetLastSeenAllRow

type GetLastSeenAllRow struct {
	FileUuid string    `json:"file_uuid"`
	LastSeen time.Time `json:"last_seen"`
}

type GetSessionAccountRow

type GetSessionAccountRow struct {
	AccountID      uuid.UUID `json:"account_id"`
	Username       string    `json:"username"`
	RegisterDate   time.Time `json:"register_date"`
	LastLogin      time.Time `json:"last_login"`
	ActivityPoints int32     `json:"activity_points"`
}

type GetSessionOwnerFilesParams

type GetSessionOwnerFilesParams struct {
	SessionID string `json:"session_id"`
	Limit     int32  `json:"limit"`
}

type GetSessionOwnerFilesRow

type GetSessionOwnerFilesRow struct {
	Filename   string         `json:"filename"`
	Title      sql.NullString `json:"title"`
	FileSize   int32          `json:"file_size"`
	Viewcount  int32          `json:"viewcount"`
	Encrypted  bool           `json:"encrypted"`
	UploadDate time.Time      `json:"upload_date"`
	LastSeen   time.Time      `json:"last_seen"`
}

type GetSessionsRow

type GetSessionsRow struct {
	SessionID string    `json:"session_id"`
	StartDate time.Time `json:"start_date"`
}

type NewAccountParams

type NewAccountParams struct {
	Username string `json:"username"`
	Password string `json:"password"`
}

type NewAccountSessionParams

type NewAccountSessionParams struct {
	SessionID  string    `json:"session_id"`
	Username   string    `json:"username"`
	ExpireDate time.Time `json:"expire_date"`
}

type NewFeedbackParams

type NewFeedbackParams struct {
	Comment sql.NullString `json:"comment"`
	Boxes   string         `json:"boxes"`
}

type NewFileParams

type NewFileParams struct {
	FileUuid     string         `json:"file_uuid"`
	Title        sql.NullString `json:"title"`
	Passwdhash   sql.NullString `json:"passwdhash"`
	AccessToken  string         `json:"access_token"`
	EncryptionIv []byte         `json:"encryption_iv"`
	Encrypted    bool           `json:"encrypted"`
	FileSize     int32          `json:"file_size"`
	FileHash     string         `json:"file_hash"`
}

type NewReportParams

type NewReportParams struct {
	FileUuid string `json:"file_uuid"`
	Reason   string `json:"reason"`
}

type NullTokenType

type NullTokenType struct {
	TokenType TokenType
	Valid     bool // Valid is true if TokenType is not NULL
}

func (*NullTokenType) Scan

func (ns *NullTokenType) Scan(value interface{}) error

Scan implements the Scanner interface.

func (NullTokenType) Value

func (ns NullTokenType) Value() (driver.Value, error)

Value implements the driver Valuer interface.

type PeerBan

type PeerBan struct {
	PeerID string `json:"peer_id"`
}

type Queries

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

func New

func New(db DBTX) *Queries

func (*Queries) BanPeer

func (q *Queries) BanPeer(ctx context.Context, peerID string) error

func (*Queries) DeleteAccount

func (q *Queries) DeleteAccount(ctx context.Context, accountID uuid.UUID) error

func (*Queries) DeleteFile

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

func (*Queries) DeleteSession

func (q *Queries) DeleteSession(ctx context.Context, arg DeleteSessionParams) (string, error)

func (*Queries) DeleteSessions

func (q *Queries) DeleteSessions(ctx context.Context, sessionID string) ([]string, error)

func (*Queries) FileToAccount

func (q *Queries) FileToAccount(ctx context.Context, arg FileToAccountParams) error

func (*Queries) GetAccessToken

func (q *Queries) GetAccessToken(ctx context.Context, fileUuid string) (string, error)

func (*Queries) GetAccountPasswordHash

func (q *Queries) GetAccountPasswordHash(ctx context.Context, username string) (string, error)

func (*Queries) GetAllSessionOwnerFiles

func (q *Queries) GetAllSessionOwnerFiles(ctx context.Context, sessionID string) ([]string, error)

func (*Queries) GetEncryptedStatus

func (q *Queries) GetEncryptedStatus(ctx context.Context, fileUuid string) (bool, error)

func (*Queries) GetEncryptionIV

func (q *Queries) GetEncryptionIV(ctx context.Context, fileUuid string) ([]byte, error)

func (*Queries) GetFeedbacks

func (q *Queries) GetFeedbacks(ctx context.Context, limit int32) ([]GetFeedbacksRow, error)

func (*Queries) GetFileInformation

func (q *Queries) GetFileInformation(ctx context.Context, fileUuid string) (GetFileInformationRow, error)

func (*Queries) GetFilename

func (q *Queries) GetFilename(ctx context.Context, accessToken string) (string, error)

func (*Queries) GetLastSeenAll

func (q *Queries) GetLastSeenAll(ctx context.Context) ([]GetLastSeenAllRow, error)

func (*Queries) GetPasswordHash

func (q *Queries) GetPasswordHash(ctx context.Context, fileUuid string) (sql.NullString, error)

func (*Queries) GetSessionAccount

func (q *Queries) GetSessionAccount(ctx context.Context, sessionID string) (GetSessionAccountRow, error)

func (*Queries) GetSessionOwnerFiles

func (q *Queries) GetSessionOwnerFiles(ctx context.Context, arg GetSessionOwnerFilesParams) ([]GetSessionOwnerFilesRow, error)

func (*Queries) GetSessions

func (q *Queries) GetSessions(ctx context.Context, sessionID string) ([]GetSessionsRow, error)

func (*Queries) IsBanned

func (q *Queries) IsBanned(ctx context.Context, peerID string) (string, error)

func (*Queries) NewAccount

func (q *Queries) NewAccount(ctx context.Context, arg NewAccountParams) (Account, error)

func (*Queries) NewAccountSession

func (q *Queries) NewAccountSession(ctx context.Context, arg NewAccountSessionParams) (string, error)

func (*Queries) NewFeedback

func (q *Queries) NewFeedback(ctx context.Context, arg NewFeedbackParams) error

func (*Queries) NewFile

func (q *Queries) NewFile(ctx context.Context, arg NewFileParams) error

func (*Queries) NewReport

func (q *Queries) NewReport(ctx context.Context, arg NewReportParams) error

func (*Queries) RemoveBan

func (q *Queries) RemoveBan(ctx context.Context, peerID string) error

func (*Queries) ResetPassword

func (q *Queries) ResetPassword(ctx context.Context, arg ResetPasswordParams) (string, error)

func (*Queries) UpdateLastSeen

func (q *Queries) UpdateLastSeen(ctx context.Context, fileUuid string) error

func (*Queries) UpdateViewCount

func (q *Queries) UpdateViewCount(ctx context.Context, fileUuid string) error

func (*Queries) WithTx

func (q *Queries) WithTx(tx pgx.Tx) *Queries

type Report

type Report struct {
	FileUuid string `json:"file_uuid"`
	Reason   string `json:"reason"`
}

type ResetPasswordParams

type ResetPasswordParams struct {
	Password  string    `json:"password"`
	AccountID uuid.UUID `json:"account_id"`
}

type TokenType

type TokenType string
const (
	TokenTypeRefresh        TokenType = "refresh"
	TokenTypeAuthentication TokenType = "authentication"
)

func (*TokenType) Scan

func (e *TokenType) Scan(src interface{}) error

Jump to

Keyboard shortcuts

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