sqlitedb

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2026 License: AGPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

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 DeleteDeviceParams

type DeleteDeviceParams struct {
	UserID    string
	PushToken string
}

type DeleteHostByUserParams

type DeleteHostByUserParams struct {
	UserID   string
	Provider string
}

type Device

type Device struct {
	UserID     string
	PushToken  string
	Platform   string
	CreatedAt  time.Time
	LastSeenAt time.Time
}

type GetHostByUserParams

type GetHostByUserParams struct {
	UserID   string
	Provider string
}

type Host

type Host struct {
	ID            string
	UserID        string
	Provider      string
	ExternalID    string
	Hostname      string
	Status        string
	LastUrl       string
	LastToken     string
	AuthToken     string
	NotifierToken string
	AutoWake      int64
	ProviderMeta  string
	CreatedAt     time.Time
	UpdatedAt     time.Time
}

type InsertHostIfAbsentParams

type InsertHostIfAbsentParams struct {
	ID            string
	UserID        string
	Provider      string
	ExternalID    string
	Hostname      string
	Status        string
	LastUrl       string
	LastToken     string
	AuthToken     string
	NotifierToken string
	AutoWake      int64
	CreatedAt     time.Time
	UpdatedAt     time.Time
}

type Querier

type Querier interface {
	DeleteDevice(ctx context.Context, arg DeleteDeviceParams) error
	// Used by the dispatcher when Expo returns DeviceNotRegistered for a
	// token; the user_id is irrelevant, the token itself is dead.
	DeleteDeviceByPushToken(ctx context.Context, pushToken string) error
	DeleteHostByID(ctx context.Context, id string) error
	DeleteHostByUser(ctx context.Context, arg DeleteHostByUserParams) error
	GetHostByID(ctx context.Context, id string) (Host, error)
	GetHostByNotifierToken(ctx context.Context, notifierToken string) (Host, error)
	GetHostByUser(ctx context.Context, arg GetHostByUserParams) (Host, error)
	// The cross-instance claim: exactly one concurrent caller inserts;
	// everyone else reads the winner's row back. provider_meta is left to
	// its default (CASProviderMeta is its only writer). ASCII only here:
	// sqlc slices query text by byte offset but counts chars, so a
	// multi-byte character in a comment corrupts every later query.
	InsertHostIfAbsent(ctx context.Context, arg InsertHostIfAbsentParams) (int64, error)
	ListDevicesByUser(ctx context.Context, userID string) ([]Device, error)
	UpsertDevice(ctx context.Context, arg UpsertDeviceParams) error
	UpsertHost(ctx context.Context, arg UpsertHostParams) error
}

type Queries

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

func New

func New(db DBTX) *Queries

func (*Queries) DeleteDevice

func (q *Queries) DeleteDevice(ctx context.Context, arg DeleteDeviceParams) error

func (*Queries) DeleteDeviceByPushToken

func (q *Queries) DeleteDeviceByPushToken(ctx context.Context, pushToken string) error

Used by the dispatcher when Expo returns DeviceNotRegistered for a token; the user_id is irrelevant, the token itself is dead.

func (*Queries) DeleteHostByID

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

func (*Queries) DeleteHostByUser

func (q *Queries) DeleteHostByUser(ctx context.Context, arg DeleteHostByUserParams) error

func (*Queries) GetHostByID

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

func (*Queries) GetHostByNotifierToken

func (q *Queries) GetHostByNotifierToken(ctx context.Context, notifierToken string) (Host, error)

func (*Queries) GetHostByUser

func (q *Queries) GetHostByUser(ctx context.Context, arg GetHostByUserParams) (Host, error)

func (*Queries) InsertHostIfAbsent

func (q *Queries) InsertHostIfAbsent(ctx context.Context, arg InsertHostIfAbsentParams) (int64, error)

The cross-instance claim: exactly one concurrent caller inserts; everyone else reads the winner's row back. provider_meta is left to its default (CASProviderMeta is its only writer). ASCII only here: sqlc slices query text by byte offset but counts chars, so a multi-byte character in a comment corrupts every later query.

func (*Queries) ListDevicesByUser

func (q *Queries) ListDevicesByUser(ctx context.Context, userID string) ([]Device, error)

func (*Queries) UpsertDevice

func (q *Queries) UpsertDevice(ctx context.Context, arg UpsertDeviceParams) error

func (*Queries) UpsertHost

func (q *Queries) UpsertHost(ctx context.Context, arg UpsertHostParams) error

func (*Queries) WithTx

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

type UpsertDeviceParams

type UpsertDeviceParams struct {
	UserID     string
	PushToken  string
	Platform   string
	CreatedAt  time.Time
	LastSeenAt time.Time
}

type UpsertHostParams

type UpsertHostParams struct {
	ID            string
	UserID        string
	Provider      string
	ExternalID    string
	Hostname      string
	Status        string
	LastUrl       string
	LastToken     string
	AuthToken     string
	NotifierToken string
	AutoWake      int64
	CreatedAt     time.Time
	UpdatedAt     time.Time
}

Jump to

Keyboard shortcuts

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