Documentation
¶
Overview ¶
Package sqlc provides a set of custom database queries and utilities for interacting with the SQL database used in the application. It includes generated code from sqlc as well as custom wrappers to handle different database backends.
Index ¶
- type Channel
- type ChannelEvent
- type DBTX
- type GetChannelEventsParams
- type GetChannelsRow
- type GetLatestChannelEventBeforeParams
- type InsertChannelEventParams
- type InsertChannelParams
- type Peer
- type Querier
- type Queries
- func (q *Queries) Backend() sqldb.BackendType
- func (q *Queries) GetChannelByChanPoint(ctx context.Context, channelPoint string) (Channel, error)
- func (q *Queries) GetChannelByShortChanID(ctx context.Context, shortChannelID int64) (Channel, error)
- func (q *Queries) GetChannelEvents(ctx context.Context, arg GetChannelEventsParams) ([]ChannelEvent, error)
- func (q *Queries) GetChannels(ctx context.Context) ([]GetChannelsRow, error)
- func (q *Queries) GetLatestChannelEventBefore(ctx context.Context, arg GetLatestChannelEventBeforeParams) (ChannelEvent, error)
- func (q *Queries) GetPeerByPubKey(ctx context.Context, pubkey string) (Peer, error)
- func (q *Queries) InsertChannel(ctx context.Context, arg InsertChannelParams) (int64, error)
- func (q *Queries) InsertChannelEvent(ctx context.Context, arg InsertChannelEventParams) error
- func (q *Queries) InsertPeer(ctx context.Context, pubkey string) (int64, error)
- func (q *Queries) PruneChannelEventsByAge(ctx context.Context, timestamp time.Time) (int64, error)
- func (q *Queries) PruneChannelEventsBySize(ctx context.Context, offset int32) (int64, error)
- func (q *Queries) WithTx(tx *sql.Tx) *Queries
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ChannelEvent ¶
type GetChannelEventsParams ¶
type GetChannelsRow ¶
type InsertChannelParams ¶
type Querier ¶
type Querier interface {
GetChannelByChanPoint(ctx context.Context, channelPoint string) (Channel, error)
GetChannelByShortChanID(ctx context.Context, shortChannelID int64) (Channel, error)
GetChannelEvents(ctx context.Context, arg GetChannelEventsParams) ([]ChannelEvent, error)
GetChannels(ctx context.Context) ([]GetChannelsRow, error)
GetLatestChannelEventBefore(ctx context.Context, arg GetLatestChannelEventBeforeParams) (ChannelEvent, error)
GetPeerByPubKey(ctx context.Context, pubkey string) (Peer, error)
InsertChannel(ctx context.Context, arg InsertChannelParams) (int64, error)
InsertChannelEvent(ctx context.Context, arg InsertChannelEventParams) error
InsertPeer(ctx context.Context, pubkey string) (int64, error)
// PruneChannelEventsByAge enforces the retention window on the channel_events
// table, returning the number of rows deleted. It deletes any row whose
// timestamp predates the given cutoff.
PruneChannelEventsByAge(ctx context.Context, timestamp time.Time) (int64, error)
// PruneChannelEventsBySize enforces the size ceiling on the channel_events
// table, returning the number of rows deleted. It keeps the newest rows by
// deleting everything with a smaller (earlier-inserted) id than the id found at
// the given offset from the newest row, so an offset of (max-events - 1) keeps
// exactly max-events rows.
PruneChannelEventsBySize(ctx context.Context, offset int32) (int64, error)
}
type Queries ¶
type Queries struct {
// contains filtered or unexported fields
}
func NewForType ¶
func NewForType(db DBTX, typ sqldb.BackendType) *Queries
NewForType creates a new Queries instance for the given database type.
func (*Queries) Backend ¶
func (q *Queries) Backend() sqldb.BackendType
Backend returns the type of database backend we're using.
func (*Queries) GetChannelByChanPoint ¶
func (*Queries) GetChannelByShortChanID ¶
func (*Queries) GetChannelEvents ¶
func (q *Queries) GetChannelEvents(ctx context.Context, arg GetChannelEventsParams) ([]ChannelEvent, error)
func (*Queries) GetChannels ¶
func (q *Queries) GetChannels(ctx context.Context) ([]GetChannelsRow, error)
func (*Queries) GetLatestChannelEventBefore ¶
func (q *Queries) GetLatestChannelEventBefore(ctx context.Context, arg GetLatestChannelEventBeforeParams) (ChannelEvent, error)
func (*Queries) GetPeerByPubKey ¶
func (*Queries) InsertChannel ¶
func (*Queries) InsertChannelEvent ¶
func (q *Queries) InsertChannelEvent(ctx context.Context, arg InsertChannelEventParams) error
func (*Queries) InsertPeer ¶
func (*Queries) PruneChannelEventsByAge ¶
PruneChannelEventsByAge enforces the retention window on the channel_events table, returning the number of rows deleted. It deletes any row whose timestamp predates the given cutoff.
func (*Queries) PruneChannelEventsBySize ¶
PruneChannelEventsBySize enforces the size ceiling on the channel_events table, returning the number of rows deleted. It keeps the newest rows by deleting everything with a smaller (earlier-inserted) id than the id found at the given offset from the newest row, so an offset of (max-events - 1) keeps exactly max-events rows.