db

package
v0.0.0-...-a90a58e Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AttendanceMember

type AttendanceMember struct {
	ID        int64              `json:"id"`
	StreamID  int64              `json:"stream_id"`
	Username  string             `json:"username"`
	IsShouted bool               `json:"is_shouted"`
	PresentAt pgtype.Timestamptz `json:"present_at"`
	CreatedAt pgtype.Timestamptz `json:"created_at"`
}

type ConfigTypes

type ConfigTypes string
const (
	ConfigTypesAutoShoutoutActivation ConfigTypes = "auto_shoutout_activation"
	ConfigTypesAutoShoutoutDelay      ConfigTypes = "auto_shoutout_delay"
	ConfigTypesBlacklist              ConfigTypes = "blacklist"
	ConfigTypesTimerCardSoActivation  ConfigTypes = "timer_card_so_activation"
	ConfigTypesTimerCardDuration      ConfigTypes = "timer_card_duration"
)

func (*ConfigTypes) Scan

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

type CreateAttendanceMemberParams

type CreateAttendanceMemberParams struct {
	StreamID  int64              `json:"stream_id"`
	Username  string             `json:"username"`
	IsShouted bool               `json:"is_shouted"`
	PresentAt pgtype.Timestamptz `json:"present_at"`
}

type CreateSessionParams

type CreateSessionParams struct {
	ID                   pgtype.UUID        `json:"id"`
	UserID               int64              `json:"user_id"`
	RefreshToken         string             `json:"refresh_token"`
	UserAgent            string             `json:"user_agent"`
	ClientIp             string             `json:"client_ip"`
	IsBlocked            bool               `json:"is_blocked"`
	ExpiresAt            pgtype.Timestamptz `json:"expires_at"`
	EncryptedTwitchToken string             `json:"encrypted_twitch_token"`
}

type CreateStreamParams

type CreateStreamParams struct {
	UserID    int64              `json:"user_id"`
	Title     string             `json:"title"`
	GameName  string             `json:"game_name"`
	StartedAt pgtype.Timestamptz `json:"started_at"`
	CreatedBy int64              `json:"created_by"`
}

type CreateUserConfigParams

type CreateUserConfigParams struct {
	UserID     int64       `json:"user_id"`
	ConfigType ConfigTypes `json:"config_type"`
	Value      string      `json:"value"`
}

type CreateUserParams

type CreateUserParams struct {
	UserID          string `json:"user_id"`
	UserLogin       string `json:"user_login"`
	UserName        string `json:"user_name"`
	ProfileImageUrl string `json:"profile_image_url"`
}

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 GetSessionByRefreshTokenRow

type GetSessionByRefreshTokenRow struct {
	ID                   pgtype.UUID        `json:"id"`
	UserID               int64              `json:"user_id"`
	RefreshToken         string             `json:"refresh_token"`
	UserAgent            string             `json:"user_agent"`
	ClientIp             string             `json:"client_ip"`
	IsBlocked            bool               `json:"is_blocked"`
	ExpiresAt            pgtype.Timestamptz `json:"expires_at"`
	CreatedAt            pgtype.Timestamptz `json:"created_at"`
	EncryptedTwitchToken string             `json:"encrypted_twitch_token"`
	UpdatedAt            pgtype.Timestamptz `json:"updated_at"`
	ID_2                 int64              `json:"id_2"`
	UserID_2             string             `json:"user_id_2"`
	UserLogin            string             `json:"user_login"`
	UserName             string             `json:"user_name"`
	ProfileImageUrl      string             `json:"profile_image_url"`
	CreatedAt_2          pgtype.Timestamptz `json:"created_at_2"`
	UpdatedAt_2          pgtype.Timestamptz `json:"updated_at_2"`
}

type GetSessionByUserIDRow

type GetSessionByUserIDRow struct {
	ID                   pgtype.UUID        `json:"id"`
	UserID               int64              `json:"user_id"`
	RefreshToken         string             `json:"refresh_token"`
	UserAgent            string             `json:"user_agent"`
	ClientIp             string             `json:"client_ip"`
	IsBlocked            bool               `json:"is_blocked"`
	ExpiresAt            pgtype.Timestamptz `json:"expires_at"`
	CreatedAt            pgtype.Timestamptz `json:"created_at"`
	EncryptedTwitchToken string             `json:"encrypted_twitch_token"`
	UpdatedAt            pgtype.Timestamptz `json:"updated_at"`
	ID_2                 int64              `json:"id_2"`
	UserID_2             string             `json:"user_id_2"`
	UserLogin            string             `json:"user_login"`
	UserName             string             `json:"user_name"`
	ProfileImageUrl      string             `json:"profile_image_url"`
	CreatedAt_2          pgtype.Timestamptz `json:"created_at_2"`
	UpdatedAt_2          pgtype.Timestamptz `json:"updated_at_2"`
}

type GetSessionParams

type GetSessionParams struct {
	ID     pgtype.UUID `json:"id"`
	UserID int64       `json:"user_id"`
}

type GetSessionRow

type GetSessionRow struct {
	ID                   pgtype.UUID        `json:"id"`
	UserID               int64              `json:"user_id"`
	RefreshToken         string             `json:"refresh_token"`
	UserAgent            string             `json:"user_agent"`
	ClientIp             string             `json:"client_ip"`
	IsBlocked            bool               `json:"is_blocked"`
	ExpiresAt            pgtype.Timestamptz `json:"expires_at"`
	CreatedAt            pgtype.Timestamptz `json:"created_at"`
	EncryptedTwitchToken string             `json:"encrypted_twitch_token"`
	UpdatedAt            pgtype.Timestamptz `json:"updated_at"`
	ID_2                 int64              `json:"id_2"`
	UserID_2             string             `json:"user_id_2"`
	UserLogin            string             `json:"user_login"`
	UserName             string             `json:"user_name"`
	ProfileImageUrl      string             `json:"profile_image_url"`
	CreatedAt_2          pgtype.Timestamptz `json:"created_at_2"`
	UpdatedAt_2          pgtype.Timestamptz `json:"updated_at_2"`
}

type GetStreamAttendanceMembersParams

type GetStreamAttendanceMembersParams struct {
	Limit    int32 `json:"limit"`
	Offset   int32 `json:"offset"`
	StreamID int64 `json:"stream_id"`
	UserID   int64 `json:"user_id"`
}

type GetStreamAttendanceMembersRow

type GetStreamAttendanceMembersRow struct {
	Title     string             `json:"title"`
	GameName  string             `json:"game_name"`
	StartedAt pgtype.Timestamptz `json:"started_at"`
	Username  string             `json:"username"`
	IsShouted bool               `json:"is_shouted"`
	PresentAt pgtype.Timestamptz `json:"present_at"`
}

type GetStreamParams

type GetStreamParams struct {
	ID     int64 `json:"id"`
	UserID int64 `json:"user_id"`
}

type GetStreamRow

type GetStreamRow struct {
	ID        int64              `json:"id"`
	Title     string             `json:"title"`
	GameName  string             `json:"game_name"`
	StartedAt pgtype.Timestamptz `json:"started_at"`
	CreatedBy string             `json:"created_by"`
}

type GetUserConfigParams

type GetUserConfigParams struct {
	UserID     int64       `json:"user_id"`
	ConfigType ConfigTypes `json:"config_type"`
}

type GetUserConfigRow

type GetUserConfigRow struct {
	ID              int64              `json:"id"`
	UserID          int64              `json:"user_id"`
	ConfigType      ConfigTypes        `json:"config_type"`
	Value           string             `json:"value"`
	CreatedAt       pgtype.Timestamptz `json:"created_at"`
	UpdatedAt       pgtype.Timestamptz `json:"updated_at"`
	ID_2            int64              `json:"id_2"`
	UserID_2        string             `json:"user_id_2"`
	UserLogin       string             `json:"user_login"`
	UserName        string             `json:"user_name"`
	ProfileImageUrl string             `json:"profile_image_url"`
	CreatedAt_2     pgtype.Timestamptz `json:"created_at_2"`
	UpdatedAt_2     pgtype.Timestamptz `json:"updated_at_2"`
}

type GetUserRow

type GetUserRow struct {
	ID              int64  `json:"id"`
	UserLogin       string `json:"user_login"`
	UserName        string `json:"user_name"`
	ProfileImageUrl string `json:"profile_image_url"`
}

type ListSessionRow

type ListSessionRow struct {
	ID                   pgtype.UUID        `json:"id"`
	UserID               int64              `json:"user_id"`
	RefreshToken         string             `json:"refresh_token"`
	UserAgent            string             `json:"user_agent"`
	ClientIp             string             `json:"client_ip"`
	IsBlocked            bool               `json:"is_blocked"`
	ExpiresAt            pgtype.Timestamptz `json:"expires_at"`
	CreatedAt            pgtype.Timestamptz `json:"created_at"`
	EncryptedTwitchToken string             `json:"encrypted_twitch_token"`
	UpdatedAt            pgtype.Timestamptz `json:"updated_at"`
	ID_2                 int64              `json:"id_2"`
	UserID_2             string             `json:"user_id_2"`
	UserLogin            string             `json:"user_login"`
	UserName             string             `json:"user_name"`
	ProfileImageUrl      string             `json:"profile_image_url"`
	CreatedAt_2          pgtype.Timestamptz `json:"created_at_2"`
	UpdatedAt_2          pgtype.Timestamptz `json:"updated_at_2"`
}

type ListStreamsParams

type ListStreamsParams struct {
	Limit  int32 `json:"limit"`
	Offset int32 `json:"offset"`
	UserID int64 `json:"user_id"`
}

type ListStreamsRow

type ListStreamsRow struct {
	ID        int64              `json:"id"`
	Title     string             `json:"title"`
	GameName  string             `json:"game_name"`
	StartedAt pgtype.Timestamptz `json:"started_at"`
	CreatedBy string             `json:"created_by"`
}

type ListUsersParams

type ListUsersParams struct {
	Limit  int32 `json:"limit"`
	Offset int32 `json:"offset"`
}

type NullConfigTypes

type NullConfigTypes struct {
	ConfigTypes ConfigTypes `json:"config_types"`
	Valid       bool        `json:"valid"` // Valid is true if ConfigTypes is not NULL
}

func (*NullConfigTypes) Scan

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

Scan implements the Scanner interface.

func (NullConfigTypes) Value

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

Value implements the driver Valuer interface.

type Querier

type Querier interface {
	CreateAttendanceMember(ctx context.Context, arg CreateAttendanceMemberParams) (AttendanceMember, error)
	CreateSession(ctx context.Context, arg CreateSessionParams) (Session, error)
	CreateStream(ctx context.Context, arg CreateStreamParams) (Stream, error)
	CreateUser(ctx context.Context, arg CreateUserParams) (User, error)
	CreateUserConfig(ctx context.Context, arg CreateUserConfigParams) (UserConfig, error)
	DeleteSession(ctx context.Context, id pgtype.UUID) error
	DeleteStream(ctx context.Context, id int64) error
	DeleteUser(ctx context.Context, id int64) error
	DeleteUserConfig(ctx context.Context, id int64) error
	GetSession(ctx context.Context, arg GetSessionParams) (GetSessionRow, error)
	GetSessionByRefreshToken(ctx context.Context, refreshToken string) (GetSessionByRefreshTokenRow, error)
	GetSessionByUserID(ctx context.Context, userID string) (GetSessionByUserIDRow, error)
	GetStream(ctx context.Context, arg GetStreamParams) (GetStreamRow, error)
	GetStreamAttendanceMembers(ctx context.Context, arg GetStreamAttendanceMembersParams) ([]GetStreamAttendanceMembersRow, error)
	GetUser(ctx context.Context, id int64) (GetUserRow, error)
	GetUserByUserID(ctx context.Context, userID string) (User, error)
	GetUserByUserLogin(ctx context.Context, userLogin string) (User, error)
	GetUserConfig(ctx context.Context, arg GetUserConfigParams) (GetUserConfigRow, error)
	ListSession(ctx context.Context) ([]ListSessionRow, error)
	ListStreams(ctx context.Context, arg ListStreamsParams) ([]ListStreamsRow, error)
	ListUsers(ctx context.Context, arg ListUsersParams) ([]User, error)
	UpdateSession(ctx context.Context, arg UpdateSessionParams) error
	UpdateUser(ctx context.Context, arg UpdateUserParams) (User, error)
	UpdateUserConfig(ctx context.Context, arg UpdateUserConfigParams) (UserConfig, error)
}

type Queries

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

func New

func New(db DBTX) *Queries

func (*Queries) CreateAttendanceMember

func (q *Queries) CreateAttendanceMember(ctx context.Context, arg CreateAttendanceMemberParams) (AttendanceMember, error)

func (*Queries) CreateSession

func (q *Queries) CreateSession(ctx context.Context, arg CreateSessionParams) (Session, error)

func (*Queries) CreateStream

func (q *Queries) CreateStream(ctx context.Context, arg CreateStreamParams) (Stream, error)

func (*Queries) CreateUser

func (q *Queries) CreateUser(ctx context.Context, arg CreateUserParams) (User, error)

func (*Queries) CreateUserConfig

func (q *Queries) CreateUserConfig(ctx context.Context, arg CreateUserConfigParams) (UserConfig, error)

func (*Queries) DeleteSession

func (q *Queries) DeleteSession(ctx context.Context, id pgtype.UUID) error

func (*Queries) DeleteStream

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

func (*Queries) DeleteUser

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

func (*Queries) DeleteUserConfig

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

func (*Queries) GetSession

func (q *Queries) GetSession(ctx context.Context, arg GetSessionParams) (GetSessionRow, error)

func (*Queries) GetSessionByRefreshToken

func (q *Queries) GetSessionByRefreshToken(ctx context.Context, refreshToken string) (GetSessionByRefreshTokenRow, error)

func (*Queries) GetSessionByUserID

func (q *Queries) GetSessionByUserID(ctx context.Context, userID string) (GetSessionByUserIDRow, error)

func (*Queries) GetStream

func (q *Queries) GetStream(ctx context.Context, arg GetStreamParams) (GetStreamRow, error)

func (*Queries) GetStreamAttendanceMembers

func (q *Queries) GetStreamAttendanceMembers(ctx context.Context, arg GetStreamAttendanceMembersParams) ([]GetStreamAttendanceMembersRow, error)

func (*Queries) GetUser

func (q *Queries) GetUser(ctx context.Context, id int64) (GetUserRow, error)

func (*Queries) GetUserByUserID

func (q *Queries) GetUserByUserID(ctx context.Context, userID string) (User, error)

func (*Queries) GetUserByUserLogin

func (q *Queries) GetUserByUserLogin(ctx context.Context, userLogin string) (User, error)

func (*Queries) GetUserConfig

func (q *Queries) GetUserConfig(ctx context.Context, arg GetUserConfigParams) (GetUserConfigRow, error)

func (*Queries) ListSession

func (q *Queries) ListSession(ctx context.Context) ([]ListSessionRow, error)

func (*Queries) ListStreams

func (q *Queries) ListStreams(ctx context.Context, arg ListStreamsParams) ([]ListStreamsRow, error)

func (*Queries) ListUsers

func (q *Queries) ListUsers(ctx context.Context, arg ListUsersParams) ([]User, error)

func (*Queries) UpdateSession

func (q *Queries) UpdateSession(ctx context.Context, arg UpdateSessionParams) error

func (*Queries) UpdateUser

func (q *Queries) UpdateUser(ctx context.Context, arg UpdateUserParams) (User, error)

func (*Queries) UpdateUserConfig

func (q *Queries) UpdateUserConfig(ctx context.Context, arg UpdateUserConfigParams) (UserConfig, error)

func (*Queries) WithTx

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

type SQLStore

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

type Session

type Session struct {
	ID                   pgtype.UUID        `json:"id"`
	UserID               int64              `json:"user_id"`
	RefreshToken         string             `json:"refresh_token"`
	UserAgent            string             `json:"user_agent"`
	ClientIp             string             `json:"client_ip"`
	IsBlocked            bool               `json:"is_blocked"`
	ExpiresAt            pgtype.Timestamptz `json:"expires_at"`
	CreatedAt            pgtype.Timestamptz `json:"created_at"`
	EncryptedTwitchToken string             `json:"encrypted_twitch_token"`
	UpdatedAt            pgtype.Timestamptz `json:"updated_at"`
}

type Store

type Store interface {
	Querier
}

func NewStore

func NewStore(db *pgxpool.Pool) Store

type Stream

type Stream struct {
	ID int64 `json:"id"`
	// id punya user
	UserID    int64              `json:"user_id"`
	Title     string             `json:"title"`
	GameName  string             `json:"game_name"`
	StartedAt pgtype.Timestamptz `json:"started_at"`
	CreatedAt pgtype.Timestamptz `json:"created_at"`
	CreatedBy int64              `json:"created_by"`
}

type UpdateSessionParams

type UpdateSessionParams struct {
	ID                   pgtype.UUID `json:"id"`
	EncryptedTwitchToken string      `json:"encrypted_twitch_token"`
}

type UpdateUserConfigParams

type UpdateUserConfigParams struct {
	ID    int64  `json:"id"`
	Value string `json:"value"`
}

type UpdateUserParams

type UpdateUserParams struct {
	UserID          string `json:"user_id"`
	UserLogin       string `json:"user_login"`
	UserName        string `json:"user_name"`
	ProfileImageUrl string `json:"profile_image_url"`
}

type User

type User struct {
	ID int64 `json:"id"`
	// user_id punya twitch
	UserID          string             `json:"user_id"`
	UserLogin       string             `json:"user_login"`
	UserName        string             `json:"user_name"`
	ProfileImageUrl string             `json:"profile_image_url"`
	CreatedAt       pgtype.Timestamptz `json:"created_at"`
	UpdatedAt       pgtype.Timestamptz `json:"updated_at"`
}

type UserConfig

type UserConfig struct {
	ID int64 `json:"id"`
	// id punya user
	UserID     int64              `json:"user_id"`
	ConfigType ConfigTypes        `json:"config_type"`
	Value      string             `json:"value"`
	CreatedAt  pgtype.Timestamptz `json:"created_at"`
	UpdatedAt  pgtype.Timestamptz `json:"updated_at"`
}

Jump to

Keyboard shortcuts

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