db

package
v0.0.0-...-1223670 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ClimateNormal

type ClimateNormal struct {
	ID      int32       `json:"id"`
	PlaceID pgtype.Int4 `json:"place_id"`
	// Range: 1 to 12
	Month       int32              `json:"month"`
	Tavg        pgtype.Numeric     `json:"tavg"`
	Tmin        pgtype.Numeric     `json:"tmin"`
	Tmax        pgtype.Numeric     `json:"tmax"`
	Prcp        pgtype.Numeric     `json:"prcp"`
	Wspd        pgtype.Numeric     `json:"wspd"`
	Pres        pgtype.Numeric     `json:"pres"`
	Tsun        pgtype.Int4        `json:"tsun"`
	LastUpdated pgtype.Timestamptz `json:"last_updated"`
}

type CreateClimateParams

type CreateClimateParams struct {
	PlaceID     pgtype.Int4        `json:"place_id"`
	Month       int32              `json:"month"`
	Tavg        pgtype.Numeric     `json:"tavg"`
	Tmin        pgtype.Numeric     `json:"tmin"`
	Tmax        pgtype.Numeric     `json:"tmax"`
	Prcp        pgtype.Numeric     `json:"prcp"`
	Wspd        pgtype.Numeric     `json:"wspd"`
	Pres        pgtype.Numeric     `json:"pres"`
	Tsun        pgtype.Int4        `json:"tsun"`
	LastUpdated pgtype.Timestamptz `json:"last_updated"`
}

type CreatePlaceParams

type CreatePlaceParams struct {
	Name      string         `json:"name"`
	Country   string         `json:"country"`
	Latitude  pgtype.Numeric `json:"latitude"`
	Longitude pgtype.Numeric `json:"longitude"`
	Altitude  pgtype.Int4    `json:"altitude"`
}

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
}

type ListPlacesParams

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

type Place

type Place struct {
	ID        int32          `json:"id"`
	Name      string         `json:"name"`
	Country   string         `json:"country"`
	Latitude  pgtype.Numeric `json:"latitude"`
	Longitude pgtype.Numeric `json:"longitude"`
	Altitude  pgtype.Int4    `json:"altitude"`
}

type Querier

type Querier interface {
	CreateClimate(ctx context.Context, arg CreateClimateParams) (ClimateNormal, error)
	CreatePlace(ctx context.Context, arg CreatePlaceParams) (Place, error)
	DeletePlace(ctx context.Context, id int32) error
	GetClimate(ctx context.Context, placeID pgtype.Int4) (ClimateNormal, error)
	GetPlace(ctx context.Context, id int32) (Place, error)
	ListPlaces(ctx context.Context, arg ListPlacesParams) ([]Place, error)
}

type Queries

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

func New

func New(db DBTX) *Queries

func (*Queries) CreateClimate

func (q *Queries) CreateClimate(ctx context.Context, arg CreateClimateParams) (ClimateNormal, error)

func (*Queries) CreatePlace

func (q *Queries) CreatePlace(ctx context.Context, arg CreatePlaceParams) (Place, error)

func (*Queries) DeletePlace

func (q *Queries) DeletePlace(ctx context.Context, id int32) error

func (*Queries) GetClimate

func (q *Queries) GetClimate(ctx context.Context, placeID pgtype.Int4) (ClimateNormal, error)

func (*Queries) GetPlace

func (q *Queries) GetPlace(ctx context.Context, id int32) (Place, error)

func (*Queries) ListPlaces

func (q *Queries) ListPlaces(ctx context.Context, arg ListPlacesParams) ([]Place, error)

func (*Queries) WithTx

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

Jump to

Keyboard shortcuts

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