database

package
v0.0.0-...-4c708ec Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2023 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	GetQuery string = `` /* 173-byte string literal not displayed */

	GetUserIDQuery string = `
select id
from streaming.users
where twitch_id = $1;
`
	StoreQuery string = `` /* 172-byte string literal not displayed */

)

Variables

This section is empty.

Functions

func Open

func Open(uri string) (*sqlx.DB, error)

Types

type DatabaseAuthStore

type DatabaseAuthStore struct {
	DB *sqlx.DB
}

func NewAuthStore

func NewAuthStore(_ context.Context, db *sqlx.DB) *DatabaseAuthStore

func (*DatabaseAuthStore) Get

func (store *DatabaseAuthStore) Get(ctx context.Context, twitch_id string) (*auth.Tokens, error)

func (*DatabaseAuthStore) Store

func (store *DatabaseAuthStore) Store(ctx context.Context, twitch_id string, tokens auth.Tokens) error

type Flags

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

func SetupFlags

func SetupFlags(flags *pflag.FlagSet) *Flags

databaseFlags.Setup()

func (Flags) Database

func (f Flags) Database(ctx context.Context, logger logr.Logger) (*sqlx.DB, error)

func (Flags) MustDatabase

func (f Flags) MustDatabase(ctx context.Context, logger logr.Logger) *sqlx.DB

type Token

type Token struct {
	ID        uuid.UUID `db:"id"`
	CreatedAt time.Time `db:"created_at"`
	UpdatedAt time.Time `db:"updated_at"`

	UserID       uuid.UUID `db:"user_id"`
	AccessToken  string    `db:"access_token"`
	RefreshToken string    `db:"refresh_token"`
}

type User

type User struct {
	ID        uuid.UUID
	CreatedAt time.Time `db:"created_at"`
	UpdatedAt time.Time `db:"updated_at"`

	TwitchID *string `db:"twitch_id"`
	Username string  `db:"username"`
	Bot      bool    `db:"bot"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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