dbo

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2024 License: MPL-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrBatchAlreadyClosed = errors.New("batch already closed")
)

Functions

func Dial

func Dial(ctx context.Context, dbURL string) (*pgxpool.Pool, error)

Types

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
	SendBatch(context.Context, *pgx.Batch) pgx.BatchResults
}

type Endpoint

type Endpoint struct {
	Domain     string    `json:"domain"`
	Method     string    `json:"method"`
	Path       string    `json:"path"`
	Hits       int64     `json:"hits"`
	LastUpdate time.Time `json:"last_update"`
}

type EndpointListParams

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

type Headline

type Headline struct {
	ID        int64      `json:"id"`
	CreatedAt time.Time  `json:"created_at"`
	RequestID string     `json:"request_id"`
	Domain    string     `json:"domain"`
	Method    string     `json:"method"`
	Path      string     `json:"path"`
	IP        netip.Addr `json:"ip"`
}

type HeadlineListByEndpointParams

type HeadlineListByEndpointParams struct {
	Domain string `json:"domain"`
	Method string `json:"method"`
	Path   string `json:"path"`
	Offset int32  `json:"offset"`
	Limit  int32  `json:"limit"`
}

type HeadlineListParams

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

type Queries

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

func New

func New(db DBTX) *Queries

func (*Queries) EndpointList

func (q *Queries) EndpointList(ctx context.Context, arg EndpointListParams) ([]Endpoint, error)

func (*Queries) EndpointListTop

func (q *Queries) EndpointListTop(ctx context.Context, limit int32) ([]Endpoint, error)

func (*Queries) HeadlineList

func (q *Queries) HeadlineList(ctx context.Context, arg HeadlineListParams) ([]Headline, error)

func (*Queries) HeadlineListByEndpoint

func (q *Queries) HeadlineListByEndpoint(ctx context.Context, arg HeadlineListByEndpointParams) ([]Headline, error)

func (*Queries) RequestCreate

func (*Queries) RequestGet

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

func (*Queries) WithTx

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

type Request

type Request struct {
	ID             int64      `json:"id"`
	CreatedAt      time.Time  `json:"created_at"`
	RequestID      string     `json:"request_id"`
	Domain         string     `json:"domain"`
	Method         string     `json:"method"`
	Path           string     `json:"path"`
	URL            string     `json:"url"`
	IP             netip.Addr `json:"ip"`
	Headers        []byte     `json:"headers"`
	Content        []byte     `json:"content"`
	PartialContent bool       `json:"partial_content"`
}

type RequestCreateBatchResults

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

func (*RequestCreateBatchResults) Close

func (b *RequestCreateBatchResults) Close() error

func (*RequestCreateBatchResults) Exec

func (b *RequestCreateBatchResults) Exec(f func(int, error))

type RequestCreateParams

type RequestCreateParams struct {
	CreatedAt      time.Time  `json:"created_at"`
	Domain         string     `json:"domain"`
	Method         string     `json:"method"`
	Path           string     `json:"path"`
	URL            string     `json:"url"`
	IP             netip.Addr `json:"ip"`
	RequestID      string     `json:"request_id"`
	Headers        []byte     `json:"headers"`
	Content        []byte     `json:"content"`
	PartialContent bool       `json:"partial_content"`
}

Jump to

Keyboard shortcuts

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