db

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AutocertCache

type AutocertCache struct {
	Key       string
	Data      []byte
	CreatedAt pgtype.Timestamptz
	UpdatedAt pgtype.Timestamptz
}

type AutocertCachePutParams

type AutocertCachePutParams struct {
	Key  string
	Data []byte
}

type CreateEventsParams

type CreateEventsParams struct {
	DomainID  int32
	SessionID int64
	VisitorID string
	Name      string
	Path      string
	Referrer  string
	LoadTime  int32
	Ttfb      int32
}

type CreateSessionParams

type CreateSessionParams struct {
	DomainID       int32
	ExitPath       string
	VisitorID      pgtype.Text
	EntryPath      string
	Country        pgtype.Text
	Latitude       pgtype.Float8
	Longitude      pgtype.Float8
	Subdivision    pgtype.Text
	City           pgtype.Text
	Browser        pgtype.Text
	BrowserVersion pgtype.Text
	Os             pgtype.Text
	OsVersion      pgtype.Text
	Platform       pgtype.Text
	DeviceType     pgtype.Text
	Bot            bool
	ScreenW        pgtype.Int4
	ScreenH        pgtype.Int4
	Timezone       pgtype.Text
	PixelRatio     pgtype.Float8
	PixelDepth     pgtype.Int4
	UtmSource      pgtype.Text
	UtmMedium      pgtype.Text
	UtmCampaign    pgtype.Text
	UtmContent     pgtype.Text
	UtmTerm        pgtype.Text
}

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
	CopyFrom(ctx context.Context, tableName pgx.Identifier, columnNames []string, rowSrc pgx.CopyFromSource) (int64, error)
}

type Domain

type Domain struct {
	DomainID   int32
	DomainName string
}

type Event

type Event struct {
	ID        int64
	Name      string
	DomainID  int32
	Path      string
	Referrer  string
	VisitorID string
	SessionID int64
	LoadTime  int32
	Ttfb      int32
	CreatedAt pgtype.Timestamptz
}

type GetSessionParams

type GetSessionParams struct {
	VisitorID pgtype.Text
	Column2   pgtype.Interval
}

type Queries

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

func New

func New(db DBTX) *Queries

func (*Queries) AutocertCacheDelete

func (q *Queries) AutocertCacheDelete(ctx context.Context, key string) error

func (*Queries) AutocertCacheGet

func (q *Queries) AutocertCacheGet(ctx context.Context, key string) ([]byte, error)

func (*Queries) AutocertCachePut

func (q *Queries) AutocertCachePut(ctx context.Context, arg AutocertCachePutParams) error

func (*Queries) CreateEvents

func (q *Queries) CreateEvents(ctx context.Context, arg []CreateEventsParams) (int64, error)

func (*Queries) CreateSession

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

-- MUST call this in a transaction after GetSession ----

func (*Queries) GetEvent

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

func (*Queries) GetSalt

func (q *Queries) GetSalt(ctx context.Context) (Salt, error)

func (*Queries) GetSession

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

func (*Queries) ListEvents

func (q *Queries) ListEvents(ctx context.Context) ([]Event, error)

func (*Queries) PruneEvents

func (q *Queries) PruneEvents(ctx context.Context, theInterval pgtype.Interval) error

func (*Queries) PruneSessions

func (q *Queries) PruneSessions(ctx context.Context, theInterval pgtype.Interval) error

func (*Queries) UpdateSalt

func (q *Queries) UpdateSalt(ctx context.Context) error

func (*Queries) UpdateSession

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

-- MUST call this in a transaction after GetSession ----

func (*Queries) UpsertDomain

func (q *Queries) UpsertDomain(ctx context.Context, domainName string) (int32, error)

func (*Queries) WithTx

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

type Salt

type Salt struct {
	Salt      pgtype.UUID
	CreatedAt pgtype.Timestamptz
}

type Session

type Session struct {
	ID             int64
	UpdatedAt      pgtype.Timestamptz
	Duration       pgtype.Int4
	Bounce         bool
	ExitPath       string
	VisitorID      pgtype.Text
	CreatedAt      pgtype.Timestamptz
	DomainID       int32
	EntryPath      string
	Country        pgtype.Text
	Latitude       pgtype.Float8
	Longitude      pgtype.Float8
	Subdivision    pgtype.Text
	City           pgtype.Text
	Browser        pgtype.Text
	BrowserVersion pgtype.Text
	Os             pgtype.Text
	OsVersion      pgtype.Text
	Platform       pgtype.Text
	DeviceType     pgtype.Text
	Bot            bool
	ScreenW        pgtype.Int4
	ScreenH        pgtype.Int4
	Timezone       pgtype.Text
	PixelRatio     pgtype.Float8
	PixelDepth     pgtype.Int4
	UtmSource      pgtype.Text
	UtmMedium      pgtype.Text
	UtmCampaign    pgtype.Text
	UtmContent     pgtype.Text
	UtmTerm        pgtype.Text
}

type UpdateSessionParams

type UpdateSessionParams struct {
	ExitPath  string
	ID        int64
	EventName string
}

Jump to

Keyboard shortcuts

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