db

package
v0.0.0-...-31a8533 Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2026 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SelectedMediaTypes

func SelectedMediaTypes(mediaTypes []string) map[string]bool

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 HistoriesCategoryRenameParams

type HistoriesCategoryRenameParams struct {
	OldCategory string `json:"old_category"`
	NewCategory string `json:"new_category"`
	Username    string `json:"username"`
}

type History

type History struct {
	Username    string          `json:"username"`
	PostType    PostType        `json:"post_type"`
	PostOwner   string          `json:"post_owner"`
	Post        string          `json:"post"`
	PostDate    time.Time       `json:"post_date"`
	Files       []string        `json:"files"`
	Categories  []string        `json:"categories"`
	Incognito   bool            `json:"incognito"`
	Coordinates types.NullPoint `json:"coordinates"`
}

type HistoryAddFromArchiveParams

type HistoryAddFromArchiveParams struct {
	Username   string    `json:"username"`
	PostType   PostType  `json:"post_type"`
	PostOwner  string    `json:"post_owner"`
	Post       string    `json:"post"`
	PostDate   time.Time `json:"post_date"`
	Files      []string  `json:"files"`
	Categories []string  `json:"categories"`
}

type HistoryAddParams

type HistoryAddParams struct {
	Username   string   `json:"username"`
	PostType   PostType `json:"post_type"`
	PostOwner  string   `json:"post_owner"`
	Post       string   `json:"post"`
	Files      []string `json:"files"`
	Categories []string `json:"categories"`
	Latitude   float64  `json:"latitude"`
	Longitude  float64  `json:"longitude"`
}

type HistoryCountByFileParams

type HistoryCountByFileParams struct {
	PostType  PostType `json:"post_type"`
	PostOwner string   `json:"post_owner"`
	File      string   `json:"file"`
	Username  string   `json:"username"`
}

type HistoryCountParams

type HistoryCountParams struct {
	PostTypes           []PostType `json:"post_types"`
	Exclusive           bool       `json:"exclusive"`
	Categories          []string   `json:"categories"`
	UserCategories      []string   `json:"user_categories"`
	PostOwners          []string   `json:"post_owners"`
	Username            string     `json:"username"`
	OnlyWithCoordinates bool       `json:"only_with_coordinates"`
}

type HistoryGetByOwnerParams

type HistoryGetByOwnerParams struct {
	PostType  PostType `json:"post_type"`
	PostOwner string   `json:"post_owner"`
	Post      string   `json:"post"`
	Username  string   `json:"username"`
}

type HistoryGetPageParams

type HistoryGetPageParams struct {
	PostTypes           []PostType `json:"post_types"`
	Exclusive           bool       `json:"exclusive"`
	Categories          []string   `json:"categories"`
	UserCategories      []string   `json:"user_categories"`
	PostOwners          []string   `json:"post_owners"`
	Username            string     `json:"username"`
	OnlyWithCoordinates bool       `json:"only_with_coordinates"`
	Page                int32      `json:"page"`
	PageSize            int32      `json:"page_size"`
}

type HistoryGetParams

type HistoryGetParams struct {
	PostType PostType `json:"post_type"`
	Post     string   `json:"post"`
	Username string   `json:"username"`
}

type HistoryOwnersParams

type HistoryOwnersParams struct {
	PostTypes           []PostType `json:"post_types"`
	Exclusive           bool       `json:"exclusive"`
	Categories          []string   `json:"categories"`
	UserCategories      []string   `json:"user_categories"`
	PostOwner           string     `json:"post_owner"`
	Username            string     `json:"username"`
	OnlyWithCoordinates bool       `json:"only_with_coordinates"`
}

type HistoryOwnersRow

type HistoryOwnersRow struct {
	PostOwner string   `json:"post_owner"`
	PostType  PostType `json:"post_type"`
}

type HistoryRemoveParams

type HistoryRemoveParams struct {
	PostType  PostType `json:"post_type"`
	PostOwner string   `json:"post_owner"`
	Post      string   `json:"post"`
	Username  string   `json:"username"`
}

type HistoryUpdateCategoriesParams

type HistoryUpdateCategoriesParams struct {
	Categories []string `json:"categories"`
	PostType   PostType `json:"post_type"`
	Post       string   `json:"post"`
	PostOwner  string   `json:"post_owner"`
	Username   string   `json:"username"`
}

type HistoryUpdateCoordinatesParams

type HistoryUpdateCoordinatesParams struct {
	Latitude  float64  `json:"latitude"`
	Longitude float64  `json:"longitude"`
	PostType  PostType `json:"post_type"`
	PostOwner string   `json:"post_owner"`
	Post      string   `json:"post"`
	Username  string   `json:"username"`
}

type HistoryUpdateOwnerParams

type HistoryUpdateOwnerParams struct {
	NewOwner string   `json:"new_owner"`
	PostType PostType `json:"post_type"`
	OldOwner string   `json:"old_owner"`
	Username string   `json:"username"`
}

type NetworkType

type NetworkType string
const (
	NetworkTypeInstagram NetworkType = "instagram"
	NetworkTypeTiktok    NetworkType = "tiktok"
	NetworkTypeVsco      NetworkType = "vsco"
)

func (*NetworkType) Scan

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

func (NetworkType) Valid

func (e NetworkType) Valid() bool

type NullNetworkType

type NullNetworkType struct {
	NetworkType NetworkType `json:"network_type"`
	Valid       bool        `json:"valid"` // Valid is true if NetworkType is not NULL
}

func (*NullNetworkType) Scan

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

Scan implements the Scanner interface.

func (NullNetworkType) Value

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

Value implements the driver Valuer interface.

type NullPostType

type NullPostType struct {
	PostType PostType `json:"post_type"`
	Valid    bool     `json:"valid"` // Valid is true if PostType is not NULL
}

func (*NullPostType) Scan

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

Scan implements the Scanner interface.

func (NullPostType) Value

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

Value implements the driver Valuer interface.

type Owner

type Owner struct {
	Owner string `json:"owner"`
	Type  string `json:"type"`
}

type Passkey

type Passkey struct {
	ID              []byte    `json:"id"`
	Name            string    `json:"name"`
	UserID          uuid.UUID `json:"user_id"`
	PublicKey       []byte    `json:"public_key"`
	AttestationType string    `json:"attestation_type"`
	Aaguid          []byte    `json:"aaguid"`
	SignCount       int64     `json:"sign_count"`
	Transports      []string  `json:"transports"`
	BackupEligible  bool      `json:"backup_eligible"`
	BackupState     bool      `json:"backup_state"`
}

type PasskeyDeleteParams

type PasskeyDeleteParams struct {
	PasskeyID []byte    `json:"passkey_id"`
	UserID    uuid.UUID `json:"user_id"`
}

type PasskeyRenameParams

type PasskeyRenameParams struct {
	Name      string    `json:"name"`
	PasskeyID []byte    `json:"passkey_id"`
	UserID    uuid.UUID `json:"user_id"`
}

type PostType

type PostType string
const (
	PostTypeInstagram PostType = "instagram"
	PostTypeHighlight PostType = "highlight"
	PostTypeStory     PostType = "story"
	PostTypeTiktok    PostType = "tiktok"
	PostTypeVsco      PostType = "vsco"
	PostTypeSnapchat  PostType = "snapchat"
)

func (*PostType) Scan

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

func (PostType) Valid

func (e PostType) Valid() bool

type Querier

type Querier interface {
	HistoriesCategoryRename(ctx context.Context, arg HistoriesCategoryRenameParams) error
	HistoryAdd(ctx context.Context, arg HistoryAddParams) (History, error)
	HistoryAddFromArchive(ctx context.Context, arg HistoryAddFromArchiveParams) (History, error)
	HistoryCount(ctx context.Context, arg HistoryCountParams) (int64, error)
	HistoryCountByFile(ctx context.Context, arg HistoryCountByFileParams) (int64, error)
	HistoryGet(ctx context.Context, arg HistoryGetParams) (History, error)
	HistoryGetByOwner(ctx context.Context, arg HistoryGetByOwnerParams) (History, error)
	// https://docs.sqlc.dev/en/stable/howto/select.html#passing-a-slice-as-a-parameter-to-a-query
	// https://docs.sqlc.dev/en/stable/howto/named_parameters.html
	HistoryGetPage(ctx context.Context, arg HistoryGetPageParams) ([]History, error)
	HistoryOwners(ctx context.Context, arg HistoryOwnersParams) ([]HistoryOwnersRow, error)
	HistoryRemove(ctx context.Context, arg HistoryRemoveParams) error
	HistoryUpdateCategories(ctx context.Context, arg HistoryUpdateCategoriesParams) (History, error)
	HistoryUpdateCoordinates(ctx context.Context, arg HistoryUpdateCoordinatesParams) error
	HistoryUpdateOwner(ctx context.Context, arg HistoryUpdateOwnerParams) error
	PasskeyDelete(ctx context.Context, arg PasskeyDeleteParams) error
	PasskeyRename(ctx context.Context, arg PasskeyRenameParams) error
	PasskeyUpdateSignCount(ctx context.Context, passkeyID []byte) error
	UpdateHistoryDuplicateFile(ctx context.Context, arg UpdateHistoryDuplicateFileParams) (History, error)
	UpdateHistoryRemoveFile(ctx context.Context, arg UpdateHistoryRemoveFileParams) (History, error)
	UserAdd(ctx context.Context, arg UserAddParams) (User, error)
	UserCategoryAdd(ctx context.Context, arg UserCategoryAddParams) error
	UserCategoryRemove(ctx context.Context, arg UserCategoryRemoveParams) error
	UserCreatePasskey(ctx context.Context, arg UserCreatePasskeyParams) error
	UserGetByID(ctx context.Context, userID uuid.UUID) (User, error)
	UserGetByUsername(ctx context.Context, username string) (User, error)
	UserGetPasskeysByID(ctx context.Context, userID uuid.UUID) ([]Passkey, error)
	UserUpdateHash(ctx context.Context, arg UserUpdateHashParams) error
	UserUpdateInstagramSession(ctx context.Context, arg UserUpdateInstagramSessionParams) error
}

type Queries

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

func New

func New(db DBTX) *Queries

func Prepare

func Prepare(ctx context.Context, db DBTX) (*Queries, error)

func (*Queries) Close

func (q *Queries) Close() error

func (*Queries) HistoriesCategoryRename

func (q *Queries) HistoriesCategoryRename(ctx context.Context, arg HistoriesCategoryRenameParams) error

func (*Queries) HistoryAdd

func (q *Queries) HistoryAdd(ctx context.Context, arg HistoryAddParams) (History, error)

func (*Queries) HistoryAddFromArchive

func (q *Queries) HistoryAddFromArchive(ctx context.Context, arg HistoryAddFromArchiveParams) (History, error)

func (*Queries) HistoryCount

func (q *Queries) HistoryCount(ctx context.Context, arg HistoryCountParams) (int64, error)

func (*Queries) HistoryCountByFile

func (q *Queries) HistoryCountByFile(ctx context.Context, arg HistoryCountByFileParams) (int64, error)

func (*Queries) HistoryGet

func (q *Queries) HistoryGet(ctx context.Context, arg HistoryGetParams) (History, error)

func (*Queries) HistoryGetByOwner

func (q *Queries) HistoryGetByOwner(ctx context.Context, arg HistoryGetByOwnerParams) (History, error)

func (*Queries) HistoryOwners

func (q *Queries) HistoryOwners(ctx context.Context, arg HistoryOwnersParams) ([]HistoryOwnersRow, error)

func (*Queries) HistoryRemove

func (q *Queries) HistoryRemove(ctx context.Context, arg HistoryRemoveParams) error

func (*Queries) HistoryUpdateCategories

func (q *Queries) HistoryUpdateCategories(ctx context.Context, arg HistoryUpdateCategoriesParams) (History, error)

func (*Queries) HistoryUpdateCoordinates

func (q *Queries) HistoryUpdateCoordinates(ctx context.Context, arg HistoryUpdateCoordinatesParams) error

func (*Queries) HistoryUpdateOwner

func (q *Queries) HistoryUpdateOwner(ctx context.Context, arg HistoryUpdateOwnerParams) error

func (*Queries) PasskeyDelete

func (q *Queries) PasskeyDelete(ctx context.Context, arg PasskeyDeleteParams) error

func (*Queries) PasskeyRename

func (q *Queries) PasskeyRename(ctx context.Context, arg PasskeyRenameParams) error

func (*Queries) PasskeyUpdateSignCount

func (q *Queries) PasskeyUpdateSignCount(ctx context.Context, passkeyID []byte) error

func (*Queries) UpdateHistoryDuplicateFile

func (q *Queries) UpdateHistoryDuplicateFile(ctx context.Context, arg UpdateHistoryDuplicateFileParams) (History, error)

func (*Queries) UpdateHistoryRemoveFile

func (q *Queries) UpdateHistoryRemoveFile(ctx context.Context, arg UpdateHistoryRemoveFileParams) (History, error)

func (*Queries) UserAdd

func (q *Queries) UserAdd(ctx context.Context, arg UserAddParams) (User, error)

func (*Queries) UserCategoryAdd

func (q *Queries) UserCategoryAdd(ctx context.Context, arg UserCategoryAddParams) error

func (*Queries) UserCategoryRemove

func (q *Queries) UserCategoryRemove(ctx context.Context, arg UserCategoryRemoveParams) error

func (*Queries) UserCreatePasskey

func (q *Queries) UserCreatePasskey(ctx context.Context, arg UserCreatePasskeyParams) error

func (*Queries) UserGetByID

func (q *Queries) UserGetByID(ctx context.Context, userID uuid.UUID) (User, error)

func (*Queries) UserGetByUsername

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

func (*Queries) UserGetPasskeysByID

func (q *Queries) UserGetPasskeysByID(ctx context.Context, userID uuid.UUID) ([]Passkey, error)

func (*Queries) UserUpdateHash

func (q *Queries) UserUpdateHash(ctx context.Context, arg UserUpdateHashParams) error

func (*Queries) UserUpdateInstagramSession

func (q *Queries) UserUpdateInstagramSession(ctx context.Context, arg UserUpdateInstagramSessionParams) error

func (*Queries) WithTx

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

type UpdateHistoryDuplicateFileParams

type UpdateHistoryDuplicateFileParams struct {
	File      string   `json:"file"`
	Duplicate string   `json:"duplicate"`
	PostType  PostType `json:"post_type"`
	Post      string   `json:"post"`
	PostOwner string   `json:"post_owner"`
	Username  string   `json:"username"`
}

type UpdateHistoryRemoveFileParams

type UpdateHistoryRemoveFileParams struct {
	File      string   `json:"file"`
	PostType  PostType `json:"post_type"`
	Post      string   `json:"post"`
	PostOwner string   `json:"post_owner"`
	Username  string   `json:"username"`
}

type User

type User struct {
	Username             string      `json:"username"`
	PasswordHash         string      `json:"password_hash"`
	InstagramSessionID   string      `json:"instagram_session_id"`
	InstagramUserID      string      `json:"instagram_user_id"`
	Network              NetworkType `json:"network"`
	Categories           []string    `json:"categories"`
	TiktokSessionID      string      `json:"tiktok_session_id"`
	TiktokSessionIDGuard string      `json:"tiktok_session_id_guard"`
	ID                   uuid.UUID   `json:"id"`
}

func (*User) SelectedCategories

func (user *User) SelectedCategories(categories []string) map[string]bool

type UserAddParams

type UserAddParams struct {
	ID                 uuid.UUID `json:"id"`
	Username           string    `json:"username"`
	PasswordHash       string    `json:"password_hash"`
	InstagramSessionID string    `json:"instagram_session_id"`
	InstagramUserID    string    `json:"instagram_user_id"`
	Categories         []string  `json:"categories"`
}

type UserCategoryAddParams

type UserCategoryAddParams struct {
	Category string `json:"category"`
	Username string `json:"username"`
}

type UserCategoryRemoveParams

type UserCategoryRemoveParams struct {
	Category string `json:"category"`
	Username string `json:"username"`
}

type UserCreatePasskeyParams

type UserCreatePasskeyParams struct {
	PasskeyID       []byte    `json:"passkey_id"`
	UserID          uuid.UUID `json:"user_id"`
	Name            string    `json:"name"`
	PublicKey       []byte    `json:"public_key"`
	AttestationType string    `json:"attestation_type"`
	Aaguid          []byte    `json:"aaguid"`
	SignCount       int64     `json:"sign_count"`
	Transports      []string  `json:"transports"`
	BackupEligible  bool      `json:"backup_eligible"`
	BackupState     bool      `json:"backup_state"`
}

type UserUpdateHashParams

type UserUpdateHashParams struct {
	PasswordHash string `json:"password_hash"`
	Username     string `json:"username"`
}

type UserUpdateInstagramSessionParams

type UserUpdateInstagramSessionParams struct {
	InstagramSessionID string `json:"instagram_session_id"`
	InstagramUserID    string `json:"instagram_user_id"`
	PasswordHash       string `json:"password_hash"`
	Username           string `json:"username"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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