rdb

package
v0.0.0-...-a5060b6 Latest Latest
Warning

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

Go to latest
Published: Jul 12, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Booking

type Booking struct {
	ID        int64            `json:"id"`
	Name      string           `json:"name"`
	StartTime pgtype.Timestamp `json:"start_time"`
	EndTime   pgtype.Timestamp `json:"end_time"`
	UserID    int64            `json:"user_id"`
	Status    BookingType      `json:"status"`
	CreatedAt pgtype.Timestamp `json:"created_at"`
	UpdatedAt pgtype.Timestamp `json:"updated_at"`
}

type BookingType

type BookingType string
const (
	BookingTypePending  BookingType = "pending"
	BookingTypeApproved BookingType = "approved"
	BookingTypeCanceled BookingType = "canceled"
	BookingTypeRejected BookingType = "rejected"
)

func (*BookingType) Scan

func (e *BookingType) Scan(src interface{}) error

type CreateBookingParams

type CreateBookingParams struct {
	Name      string           `json:"name"`
	StartTime pgtype.Timestamp `json:"start_time"`
	EndTime   pgtype.Timestamp `json:"end_time"`
	UserID    int64            `json:"user_id"`
	Status    BookingType      `json:"status"`
}

type CreateUserParams

type CreateUserParams struct {
	Name     string `json:"name"`
	Email    string `json:"email"`
	Password string `json:"password"`
}

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 GetBookingsParams

type GetBookingsParams struct {
	Status     BookingType      `json:"status"`
	UserID     int64            `json:"user_id"`
	StartLimit pgtype.Timestamp `json:"start_limit"`
	EndLimit   pgtype.Timestamp `json:"end_limit"`
}

type NullBookingType

type NullBookingType struct {
	BookingType BookingType `json:"booking_type"`
	Valid       bool        `json:"valid"` // Valid is true if BookingType is not NULL
}

func (*NullBookingType) Scan

func (ns *NullBookingType) Scan(value interface{}) error

Scan implements the Scanner interface.

func (NullBookingType) Value

func (ns NullBookingType) Value() (driver.Value, error)

Value implements the driver Valuer interface.

type Queries

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

func New

func New(db DBTX) *Queries

func (*Queries) CreateBooking

func (q *Queries) CreateBooking(ctx context.Context, arg CreateBookingParams) (Booking, error)

func (*Queries) CreateUser

func (q *Queries) CreateUser(ctx context.Context, arg CreateUserParams) (User, error)

func (*Queries) DeleteBooking

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

func (*Queries) DeleteUser

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

func (*Queries) GetBooking

func (q *Queries) GetBooking(ctx context.Context, id int64) (Booking, error)

func (*Queries) GetBookingStatus

func (q *Queries) GetBookingStatus(ctx context.Context, id int64) (BookingType, error)

func (*Queries) GetBookings

func (q *Queries) GetBookings(ctx context.Context, arg GetBookingsParams) ([]Booking, error)

func (*Queries) GetUser

func (q *Queries) GetUser(ctx context.Context, id int64) (User, error)

func (*Queries) GetUserByEmail

func (q *Queries) GetUserByEmail(ctx context.Context, email string) (User, error)

func (*Queries) Ping

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

func (*Queries) TestCreateBooking

func (q *Queries) TestCreateBooking(ctx context.Context, arg TestCreateBookingParams) (Booking, error)

func (*Queries) TestCreateUser

func (q *Queries) TestCreateUser(ctx context.Context, arg TestCreateUserParams) (User, error)

func (*Queries) TestDeleteBooking

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

func (*Queries) TestDeleteUser

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

func (*Queries) UpdateBookingStatus

func (q *Queries) UpdateBookingStatus(ctx context.Context, arg UpdateBookingStatusParams) (Booking, error)

func (*Queries) WithTx

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

type TestCreateBookingParams

type TestCreateBookingParams struct {
	Name      string           `json:"name"`
	StartTime pgtype.Timestamp `json:"start_time"`
	EndTime   pgtype.Timestamp `json:"end_time"`
	UserID    int64            `json:"user_id"`
	Status    BookingType      `json:"status"`
}

type TestCreateUserParams

type TestCreateUserParams struct {
	Name     string `json:"name"`
	Email    string `json:"email"`
	Password string `json:"password"`
}

type UpdateBookingStatusParams

type UpdateBookingStatusParams struct {
	Status BookingType `json:"status"`
	ID     int64       `json:"id"`
}

type User

type User struct {
	ID        int64            `json:"id"`
	Name      string           `json:"name"`
	Email     string           `json:"email"`
	Password  string           `json:"password"`
	CreatedAt pgtype.Timestamp `json:"created_at"`
	UpdatedAt pgtype.Timestamp `json:"updated_at"`
}

Jump to

Keyboard shortcuts

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