database

package
v0.0.0-...-e42130e Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2025 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var MigrationsFS embed.FS

Functions

func Conn

func Conn() *pgxpool.Pool

func Init

func Init()

Types

type AddDisabledExtractorParams

type AddDisabledExtractorParams struct {
	ExtractorID interface{}
	ChatID      int64
}

type Chat

type Chat struct {
	ChatID    int64
	Type      ChatType
	CreatedAt pgtype.Timestamptz
	UpdatedAt pgtype.Timestamptz
}

type ChatType

type ChatType string
const (
	ChatTypePrivate ChatType = "private"
	ChatTypeGroup   ChatType = "group"
)

func (*ChatType) Scan

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

type CreateMediaFormatParams

type CreateMediaFormatParams struct {
	FormatID   string
	ItemID     int64
	FileID     string
	Type       MediaType
	AudioCodec NullMediaCodec
	VideoCodec NullMediaCodec
	Duration   pgtype.Int4
	FileSize   pgtype.Int8
	Title      pgtype.Text
	Artist     pgtype.Text
	Width      pgtype.Int4
	Height     pgtype.Int4
	Bitrate    pgtype.Int8
}

type CreateMediaParams

type CreateMediaParams struct {
	ContentID   string
	ContentUrl  string
	ExtractorID string
	Caption     pgtype.Text
	Nsfw        bool
}

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 Errors

type Errors struct {
	ID          string
	Message     string
	Occurrences int32
	FirstSeen   pgtype.Timestamp
	LastSeen    pgtype.Timestamp
}

type GetMediaByContentIDParams

type GetMediaByContentIDParams struct {
	ContentID   string
	ExtractorID string
}

type GetMediaByContentIDRow

type GetMediaByContentIDRow struct {
	ID          int64
	ContentID   string
	ContentUrl  string
	ExtractorID string
	Caption     pgtype.Text
	Nsfw        bool
}

type GetMediaFormatRow

type GetMediaFormatRow struct {
	FormatID   string
	ItemID     int64
	FileID     string
	Type       MediaType
	AudioCodec NullMediaCodec
	VideoCodec NullMediaCodec
	Duration   pgtype.Int4
	FileSize   pgtype.Int8
	Title      pgtype.Text
	Artist     pgtype.Text
	Width      pgtype.Int4
	Height     pgtype.Int4
	Bitrate    pgtype.Int8
}

type GetMediaItemsRow

type GetMediaItemsRow struct {
	ID      int64
	MediaID int64
}

type GetMediaRow

type GetMediaRow struct {
	ID          int64
	ContentID   string
	ContentUrl  string
	ExtractorID string
	Caption     pgtype.Text
	Nsfw        bool
}

type GetOrCreateChatParams

type GetOrCreateChatParams struct {
	ChatID          int64
	Type            ChatType
	Language        string
	Captions        bool
	Silent          bool
	Nsfw            bool
	MediaAlbumLimit int32
	DeleteLinks     bool
}

type GetOrCreateChatRow

type GetOrCreateChatRow struct {
	ChatID             int64
	Type               ChatType
	Nsfw               bool
	MediaAlbumLimit    int32
	Captions           bool
	Silent             bool
	Language           string
	DisabledExtractors []string
	DeleteLinks        bool
}

type GetStatsRow

type GetStatsRow struct {
	TotalPrivateChats      int64
	PrivateChatsByLanguage []byte
	TotalGroupChats        int64
	GroupChatsByLanguage   []byte
	TotalDownloads         int64
	TotalDownloadsSize     int64
}

type LogErrorParams

type LogErrorParams struct {
	ID      string
	Message string
}

type Media

type Media struct {
	ID          int64
	ContentID   string
	ContentUrl  string
	ExtractorID string
	Caption     pgtype.Text
	Nsfw        bool
	CreatedAt   pgtype.Timestamptz
	UpdatedAt   pgtype.Timestamptz
}

type MediaCodec

type MediaCodec string
const (
	MediaCodecAvc    MediaCodec = "avc"
	MediaCodecHevc   MediaCodec = "hevc"
	MediaCodecVp9    MediaCodec = "vp9"
	MediaCodecVp8    MediaCodec = "vp8"
	MediaCodecAv1    MediaCodec = "av1"
	MediaCodecWebp   MediaCodec = "webp"
	MediaCodecAac    MediaCodec = "aac"
	MediaCodecOpus   MediaCodec = "opus"
	MediaCodecVorbis MediaCodec = "vorbis"
	MediaCodecMp3    MediaCodec = "mp3"
	MediaCodecFlac   MediaCodec = "flac"
)

func (*MediaCodec) Scan

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

type MediaFormat

type MediaFormat struct {
	FormatID   string
	ItemID     int64
	FileID     string
	Type       MediaType
	AudioCodec NullMediaCodec
	VideoCodec NullMediaCodec
	Duration   pgtype.Int4
	Title      pgtype.Text
	Artist     pgtype.Text
	Width      pgtype.Int4
	Height     pgtype.Int4
	Bitrate    pgtype.Int8
	FileSize   pgtype.Int8
	CreatedAt  pgtype.Timestamptz
	UpdatedAt  pgtype.Timestamptz
}

type MediaItem

type MediaItem struct {
	ID        int64
	MediaID   int64
	CreatedAt pgtype.Timestamptz
	UpdatedAt pgtype.Timestamptz
}

type MediaType

type MediaType string
const (
	MediaTypePhoto MediaType = "photo"
	MediaTypeVideo MediaType = "video"
	MediaTypeAudio MediaType = "audio"
)

func (*MediaType) Scan

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

type NullChatType

type NullChatType struct {
	ChatType ChatType
	Valid    bool // Valid is true if ChatType is not NULL
}

func (*NullChatType) Scan

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

Scan implements the Scanner interface.

func (NullChatType) Value

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

Value implements the driver Valuer interface.

type NullMediaCodec

type NullMediaCodec struct {
	MediaCodec MediaCodec
	Valid      bool // Valid is true if MediaCodec is not NULL
}

func (*NullMediaCodec) Scan

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

Scan implements the Scanner interface.

func (NullMediaCodec) Value

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

Value implements the driver Valuer interface.

type NullMediaType

type NullMediaType struct {
	MediaType MediaType
	Valid     bool // Valid is true if MediaType is not NULL
}

func (*NullMediaType) Scan

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

Scan implements the Scanner interface.

func (NullMediaType) Value

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

Value implements the driver Valuer interface.

type Queries

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

func New

func New(db DBTX) *Queries

func Q

func Q() *Queries

func (*Queries) AddDisabledExtractor

func (q *Queries) AddDisabledExtractor(ctx context.Context, arg AddDisabledExtractorParams) error

func (*Queries) CreateMedia

func (q *Queries) CreateMedia(ctx context.Context, arg CreateMediaParams) (int64, error)

func (*Queries) CreateMediaFormat

func (q *Queries) CreateMediaFormat(ctx context.Context, arg CreateMediaFormatParams) error

func (*Queries) CreateMediaItem

func (q *Queries) CreateMediaItem(ctx context.Context, mediaID int64) (int64, error)

func (*Queries) GetErrorByID

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

func (*Queries) GetMedia

func (q *Queries) GetMedia(ctx context.Context, id int64) (GetMediaRow, error)

func (*Queries) GetMediaByContentID

func (q *Queries) GetMediaByContentID(ctx context.Context, arg GetMediaByContentIDParams) (GetMediaByContentIDRow, error)

func (*Queries) GetMediaFormat

func (q *Queries) GetMediaFormat(ctx context.Context, itemID int64) (GetMediaFormatRow, error)

func (*Queries) GetMediaItems

func (q *Queries) GetMediaItems(ctx context.Context, mediaID int64) ([]GetMediaItemsRow, error)

func (*Queries) GetOrCreateChat

func (q *Queries) GetOrCreateChat(ctx context.Context, arg GetOrCreateChatParams) (GetOrCreateChatRow, error)

func (*Queries) GetStats

func (q *Queries) GetStats(ctx context.Context, sinceDate pgtype.Timestamptz) (GetStatsRow, error)

func (*Queries) LogError

func (q *Queries) LogError(ctx context.Context, arg LogErrorParams) error

func (*Queries) RemoveDisabledExtractor

func (q *Queries) RemoveDisabledExtractor(ctx context.Context, arg RemoveDisabledExtractorParams) error

func (*Queries) SetChatLanguage

func (q *Queries) SetChatLanguage(ctx context.Context, arg SetChatLanguageParams) error

func (*Queries) SetChatMediaAlbumLimit

func (q *Queries) SetChatMediaAlbumLimit(ctx context.Context, arg SetChatMediaAlbumLimitParams) error

func (*Queries) ToggleChatCaptions

func (q *Queries) ToggleChatCaptions(ctx context.Context, chatID int64) error
func (q *Queries) ToggleChatDeleteLinks(ctx context.Context, chatID int64) error

func (*Queries) ToggleChatNsfw

func (q *Queries) ToggleChatNsfw(ctx context.Context, chatID int64) error

func (*Queries) ToggleChatSilentMode

func (q *Queries) ToggleChatSilentMode(ctx context.Context, chatID int64) error

func (*Queries) WithTx

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

type RemoveDisabledExtractorParams

type RemoveDisabledExtractorParams struct {
	ExtractorID interface{}
	ChatID      int64
}

type SetChatLanguageParams

type SetChatLanguageParams struct {
	Language string
	ChatID   int64
}

type SetChatMediaAlbumLimitParams

type SetChatMediaAlbumLimitParams struct {
	MediaAlbumLimit int32
	ChatID          int64
}

type Settings

type Settings struct {
	ChatID             int64
	Nsfw               bool
	MediaAlbumLimit    int32
	Captions           bool
	Silent             bool
	Language           string
	CreatedAt          pgtype.Timestamptz
	UpdatedAt          pgtype.Timestamptz
	DisabledExtractors []string
	DeleteLinks        bool
}

Jump to

Keyboard shortcuts

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