sqlc

package
v0.0.0-...-5e80943 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 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 Ad struct {
	ID             int64      `json:"id"`
	PublisherAdKey string     `json:"publisher_ad_key"`
	PublisherID    *int32     `json:"publisher_id"`
	CreatedAt      *time.Time `json:"created_at"`
	UpdatedAt      *time.Time `json:"updated_at"`
	PublishedAt    *time.Time `json:"published_at"`
	Category       string     `json:"category"`
	Author         *string    `json:"author"`
	Url            *string    `json:"url"`
	Title          *string    `json:"title"`
	Description    *string    `json:"description"`
	City           *string    `json:"city"`
	Neighborhood   *string    `json:"neighborhood"`
	HouseType      string     `json:"house_type"`
	Meterage       *int32     `json:"meterage"`
	RoomsCount     *int32     `json:"rooms_count"`
	Year           *int32     `json:"year"`
	Floor          *int32     `json:"floor"`
	TotalFloors    *int32     `json:"total_floors"`
	HasWarehouse   *bool      `json:"has_warehouse"`
	HasElevator    *bool      `json:"has_elevator"`
	HasParking     *bool      `json:"has_parking"`
	Lat            *float64   `json:"lat"`
	Lng            *float64   `json:"lng"`
}

type AdCategory

type AdCategory string
const (
	AdCategoryRent     AdCategory = "rent"
	AdCategoryBuy      AdCategory = "buy"
	AdCategoryMortgage AdCategory = "mortgage"
	AdCategoryOther    AdCategory = "other"
)

func (*AdCategory) Scan

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

type AdPicture

type AdPicture struct {
	ID   int64   `json:"id"`
	AdID *int64  `json:"ad_id"`
	Url  *string `json:"url"`
}

type ChangeAllCrawlJobsStatusParams

type ChangeAllCrawlJobsStatusParams struct {
	NewStatus string   `json:"new_status"`
	Statuses  []string `json:"statuses"`
}

type CheckCrawlJobExistsParams

type CheckCrawlJobExistsParams struct {
	Url      string   `json:"url"`
	Statuses []string `json:"statuses"`
}

type CrawlJob

type CrawlJob struct {
	ID         int64      `json:"id"`
	Url        string     `json:"url"`
	SourceName string     `json:"source_name"`
	PageType   string     `json:"page_type"`
	Status     string     `json:"status"`
	CreatedAt  *time.Time `json:"created_at"`
	UpdatedAt  *time.Time `json:"updated_at"`
}

type CreateAdParams

type CreateAdParams struct {
	PublisherAdKey string     `json:"publisher_ad_key"`
	PublisherID    *int32     `json:"publisher_id"`
	PublishedAt    *time.Time `json:"published_at"`
	Category       string     `json:"category"`
	Author         *string    `json:"author"`
	Url            *string    `json:"url"`
	Title          *string    `json:"title"`
	Description    *string    `json:"description"`
	City           *string    `json:"city"`
	Neighborhood   *string    `json:"neighborhood"`
	HouseType      string     `json:"house_type"`
	Meterage       *int32     `json:"meterage"`
	RoomsCount     *int32     `json:"rooms_count"`
	Year           *int32     `json:"year"`
	Floor          *int32     `json:"floor"`
	TotalFloors    *int32     `json:"total_floors"`
	HasWarehouse   *bool      `json:"has_warehouse"`
	HasElevator    *bool      `json:"has_elevator"`
	HasParking     *bool      `json:"has_parking"`
	Lat            *float64   `json:"lat"`
	Lng            *float64   `json:"lng"`
}

type CreateAdPictureParams

type CreateAdPictureParams struct {
	AdID *int64  `json:"ad_id"`
	Url  *string `json:"url"`
}

type CreateCrawlJobParams

type CreateCrawlJobParams struct {
	Url        string `json:"url"`
	SourceName string `json:"source_name"`
	PageType   string `json:"page_type"`
	Status     string `json:"status"`
}

type CreatePriceParams

type CreatePriceParams struct {
	AdID          int64  `json:"ad_id"`
	HasPrice      *bool  `json:"has_price"`
	TotalPrice    *int64 `json:"total_price"`
	PricePerMeter *int64 `json:"price_per_meter"`
	Mortgage      *int64 `json:"mortgage"`
	NormalPrice   *int64 `json:"normal_price"`
	WeekendPrice  *int64 `json:"weekend_price"`
}

type CreatePublisherParams

type CreatePublisherParams struct {
	Name string `json:"name"`
	Url  string `json:"url"`
}

type CreateUserAdParams

type CreateUserAdParams struct {
	UserID string `json:"user_id"`
	AdID   int64  `json:"ad_id"`
}

type CreateUserFavoriteAdParams

type CreateUserFavoriteAdParams struct {
	UserID string `json:"user_id"`
	AdID   int64  `json:"ad_id"`
}

type CreateUserParams

type CreateUserParams struct {
	TgID            string       `json:"tg_id"`
	Role            NullUserRole `json:"role"`
	WatchlistPeriod *int32       `json:"watchlist_period"`
}

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 DeleteUserFavoriteAdParams

type DeleteUserFavoriteAdParams struct {
	UserID string `json:"user_id"`
	AdID   int64  `json:"ad_id"`
}

type FavoriteAd

type FavoriteAd struct {
	ID     int64  `json:"id"`
	UserID string `json:"user_id"`
	AdID   int64  `json:"ad_id"`
}

type FilterAdsParams

type FilterAdsParams struct {
	PublisherID    *int32     `json:"publisher_id"`
	MinPublishedAt *time.Time `json:"min_published_at"`
	MaxPublishedAt *time.Time `json:"max_published_at"`
	Category       *string    `json:"category"`
	Author         *string    `json:"author"`
	City           *string    `json:"city"`
	Neighborhood   *string    `json:"neighborhood"`
	HouseType      *string    `json:"house_type"`
	MinMeterage    *int32     `json:"min_meterage"`
	MaxMeterage    *int32     `json:"max_meterage"`
	MinRooms       *int32     `json:"min_rooms"`
	MaxRooms       *int32     `json:"max_rooms"`
	MinYear        *int32     `json:"min_year"`
	MaxYear        *int32     `json:"max_year"`
	MinFloor       *int32     `json:"min_floor"`
	MaxFloor       *int32     `json:"max_floor"`
	MinTotalFloors *int32     `json:"min_total_floors"`
	MaxTotalFloors *int32     `json:"max_total_floors"`
	HasWarehouse   *bool      `json:"has_warehouse"`
	HasElevator    *bool      `json:"has_elevator"`
	HasParking     *bool      `json:"has_parking"`
	Lat            *float64   `json:"lat"`
	Lng            *float64   `json:"lng"`
	Radius         *int32     `json:"radius"`
	Offset         *int32     `json:"offset"`
	Limit          *int32     `json:"limit"`
}

type FilterAdsPriceBuyParams

type FilterAdsPriceBuyParams struct {
	AdIds    []int64 `json:"ad_ids"`
	MinPrice *int64  `json:"min_price"`
	MaxPrice *int64  `json:"max_price"`
}

type FilterAdsPriceMortgageParams

type FilterAdsPriceMortgageParams struct {
	AdIds    []int64 `json:"ad_ids"`
	MinPrice *int64  `json:"min_price"`
	MaxPrice *int64  `json:"max_price"`
}

type FilterAdsPriceRentParams

type FilterAdsPriceRentParams struct {
	AdIds    []int64 `json:"ad_ids"`
	MinPrice *int64  `json:"min_price"`
	MaxPrice *int64  `json:"max_price"`
}

type GetAdByIDParams

type GetAdByIDParams struct {
	UserID string `json:"user_id"`
	ID     int64  `json:"id"`
}

type GetAdByIDRow

type GetAdByIDRow struct {
	ID             int64      `json:"id"`
	PublisherAdKey string     `json:"publisher_ad_key"`
	PublisherID    *int32     `json:"publisher_id"`
	CreatedAt      *time.Time `json:"created_at"`
	UpdatedAt      *time.Time `json:"updated_at"`
	PublishedAt    *time.Time `json:"published_at"`
	Category       string     `json:"category"`
	Author         *string    `json:"author"`
	Url            *string    `json:"url"`
	Title          *string    `json:"title"`
	Description    *string    `json:"description"`
	City           *string    `json:"city"`
	Neighborhood   *string    `json:"neighborhood"`
	HouseType      string     `json:"house_type"`
	Meterage       *int32     `json:"meterage"`
	RoomsCount     *int32     `json:"rooms_count"`
	Year           *int32     `json:"year"`
	Floor          *int32     `json:"floor"`
	TotalFloors    *int32     `json:"total_floors"`
	HasWarehouse   *bool      `json:"has_warehouse"`
	HasElevator    *bool      `json:"has_elevator"`
	HasParking     *bool      `json:"has_parking"`
	Lat            *float64   `json:"lat"`
	Lng            *float64   `json:"lng"`
	FavoriteStatus bool       `json:"favorite_status"`
}

type GetAllAdsParams

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

type GetAllUsersParams

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

type GetFirstMatchingCrawlJobParams

type GetFirstMatchingCrawlJobParams struct {
	Url      string   `json:"url"`
	Statuses []string `json:"statuses"`
}

type HouseType

type HouseType string
const (
	HouseTypeApartment HouseType = "apartment"
	HouseTypeVilla     HouseType = "villa"
	HouseTypeOther     HouseType = "other"
)

func (*HouseType) Scan

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

type NullAdCategory

type NullAdCategory struct {
	AdCategory AdCategory `json:"ad_category"`
	Valid      bool       `json:"valid"` // Valid is true if AdCategory is not NULL
}

func (*NullAdCategory) Scan

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

Scan implements the Scanner interface.

func (NullAdCategory) Value

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

Value implements the driver Valuer interface.

type NullHouseType

type NullHouseType struct {
	HouseType HouseType `json:"house_type"`
	Valid     bool      `json:"valid"` // Valid is true if HouseType is not NULL
}

func (*NullHouseType) Scan

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

Scan implements the Scanner interface.

func (NullHouseType) Value

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

Value implements the driver Valuer interface.

type NullUserRole

type NullUserRole struct {
	UserRole UserRole `json:"user_role"`
	Valid    bool     `json:"valid"` // Valid is true if UserRole is not NULL
}

func (*NullUserRole) Scan

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

Scan implements the Scanner interface.

func (NullUserRole) Value

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

Value implements the driver Valuer interface.

type Price

type Price struct {
	ID            int32      `json:"id"`
	AdID          int64      `json:"ad_id"`
	FetchedAt     *time.Time `json:"fetched_at"`
	HasPrice      *bool      `json:"has_price"`
	TotalPrice    *int64     `json:"total_price"`
	PricePerMeter *int64     `json:"price_per_meter"`
	Mortgage      *int64     `json:"mortgage"`
	NormalPrice   *int64     `json:"normal_price"`
	WeekendPrice  *int64     `json:"weekend_price"`
}

type Publisher

type Publisher struct {
	ID   int32  `json:"id"`
	Name string `json:"name"`
	Url  string `json:"url"`
}

type Queries

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

func New

func New(db DBTX) *Queries

func (*Queries) ChangeAllCrawlJobsStatus

func (q *Queries) ChangeAllCrawlJobsStatus(ctx context.Context, arg ChangeAllCrawlJobsStatusParams) error

new_status: text current_statuses: text[]

func (*Queries) CheckCrawlJobExists

func (q *Queries) CheckCrawlJobExists(ctx context.Context, arg CheckCrawlJobExistsParams) (bool, error)

url: text statuses: text[]

func (*Queries) CountAds

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

func (*Queries) CreateAd

func (q *Queries) CreateAd(ctx context.Context, arg CreateAdParams) (Ad, error)

Insert a new ad

func (*Queries) CreateAdPicture

func (q *Queries) CreateAdPicture(ctx context.Context, arg CreateAdPictureParams) (AdPicture, error)

Assign a picture to a Ad

func (*Queries) CreateCrawlJob

func (q *Queries) CreateCrawlJob(ctx context.Context, arg CreateCrawlJobParams) (CrawlJob, error)

Insert a new crawl job

func (*Queries) CreatePrice

func (q *Queries) CreatePrice(ctx context.Context, arg CreatePriceParams) (Price, error)

Insert a new price entry for a specific ad

func (*Queries) CreatePublisher

func (q *Queries) CreatePublisher(ctx context.Context, arg CreatePublisherParams) (Publisher, error)

Insert a new publisher

func (*Queries) CreateUser

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

Create a new user

func (*Queries) CreateUserAd

func (q *Queries) CreateUserAd(ctx context.Context, arg CreateUserAdParams) error

Assign an ad to a user as creator of that ad

func (*Queries) CreateUserFavoriteAd

func (q *Queries) CreateUserFavoriteAd(ctx context.Context, arg CreateUserFavoriteAdParams) error

Assign an ad to a user as creator of that ad

func (*Queries) DeleteAd

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

Delete an ad by publisher_ad_key

func (*Queries) DeleteAllPicturesOfAd

func (q *Queries) DeleteAllPicturesOfAd(ctx context.Context, adID *int64) error

func (*Queries) DeletePictureByID

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

func (*Queries) DeletePublisher

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

Delete publisher by ID

func (*Queries) DeleteUser

func (q *Queries) DeleteUser(ctx context.Context, tgID string) error

Delete a user by Telegram ID

func (*Queries) DeleteUserFavoriteAd

func (q *Queries) DeleteUserFavoriteAd(ctx context.Context, arg DeleteUserFavoriteAdParams) error

Delete an ad from user's favorite list

func (*Queries) FilterAds

func (q *Queries) FilterAds(ctx context.Context, arg FilterAdsParams) ([]Ad, error)

Comprehensive ad search with all attribute filters, including ranges and additional fields

func (*Queries) FilterAdsPriceBuy

func (q *Queries) FilterAdsPriceBuy(ctx context.Context, arg FilterAdsPriceBuyParams) ([]Ad, error)

Filter ads based on list of IDs and price range (buy category)

func (*Queries) FilterAdsPriceMortgage

func (q *Queries) FilterAdsPriceMortgage(ctx context.Context, arg FilterAdsPriceMortgageParams) ([]Ad, error)

Filter ads based on list of IDs and price range (mortgage category)

func (*Queries) FilterAdsPriceRent

func (q *Queries) FilterAdsPriceRent(ctx context.Context, arg FilterAdsPriceRentParams) ([]Ad, error)

Filter ads based on list of IDs and price range (rent category)

func (*Queries) GetAdByID

func (q *Queries) GetAdByID(ctx context.Context, arg GetAdByIDParams) (GetAdByIDRow, error)

Get Ad by its ID

func (*Queries) GetAdByPublisherAdKey

func (q *Queries) GetAdByPublisherAdKey(ctx context.Context, adKey string) (int64, error)

func (*Queries) GetAdPictures

func (q *Queries) GetAdPictures(ctx context.Context, adID *int64) ([]AdPicture, error)

func (*Queries) GetAdsByIds

func (q *Queries) GetAdsByIds(ctx context.Context, adIds []int64) ([]Ad, error)

Get ads based on list of IDs

func (*Queries) GetAdsByPublisher

func (q *Queries) GetAdsByPublisher(ctx context.Context, publisherID *int32) ([]Ad, error)

Get ads by publisher ID

func (*Queries) GetAdsPublisherByAdKey

func (q *Queries) GetAdsPublisherByAdKey(ctx context.Context, adKey *int64) (string, error)

Get PublisherAdKey for one specific ad

func (*Queries) GetAdsWithoutPrice

func (q *Queries) GetAdsWithoutPrice(ctx context.Context) ([]Ad, error)

Get ads without associated price

func (*Queries) GetAllAds

func (q *Queries) GetAllAds(ctx context.Context, arg GetAllAdsParams) ([]Ad, error)

Get all ads with dynamic ordering, limit, and offset

func (*Queries) GetAllPricesByAdID

func (q *Queries) GetAllPricesByAdID(ctx context.Context, id int64) ([]Price, error)

Get all prices for a specific ad by its id

func (*Queries) GetAllUsers

func (q *Queries) GetAllUsers(ctx context.Context, arg GetAllUsersParams) ([]User, error)

Get all users with pagination

func (*Queries) GetFirstCrawlJobByStatus

func (q *Queries) GetFirstCrawlJobByStatus(ctx context.Context, status string) (CrawlJob, error)

func (*Queries) GetFirstMatchingCrawlJob

func (q *Queries) GetFirstMatchingCrawlJob(ctx context.Context, arg GetFirstMatchingCrawlJobParams) (CrawlJob, error)

url: text statuses: text[]

func (*Queries) GetLatestPriceByAdID

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

Get the latest price for a specific ad by its id

func (*Queries) GetNextAdmin

func (q *Queries) GetNextAdmin(ctx context.Context, offset int32) (User, error)

func (*Queries) GetPictureByID

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

func (*Queries) GetPublisherByName

func (q *Queries) GetPublisherByName(ctx context.Context, name *string) (Publisher, error)

Get publisher by its name

func (*Queries) GetUserAds

func (q *Queries) GetUserAds(ctx context.Context, userID string) ([]int64, error)

Avoid duplicate entries Get any ad that's created by user

func (*Queries) GetUserByTGID

func (q *Queries) GetUserByTGID(ctx context.Context, tgID string) (User, error)

Get user by Telegram ID

func (*Queries) GetUserFavoriteAds

func (q *Queries) GetUserFavoriteAds(ctx context.Context, userID string) ([]int64, error)

Avoid duplicate entries Get all user's favorite ads

func (*Queries) UpdateAd

func (q *Queries) UpdateAd(ctx context.Context, arg UpdateAdParams) (Ad, error)

Update an existing ad's details with optional fields

func (*Queries) UpdateCrawlJobStatus

func (q *Queries) UpdateCrawlJobStatus(ctx context.Context, arg UpdateCrawlJobStatusParams) (int64, error)

func (*Queries) UpdatePublisherUrl

func (q *Queries) UpdatePublisherUrl(ctx context.Context, arg UpdatePublisherUrlParams) (Publisher, error)

Update publisher URL by ID

func (*Queries) UpdateUserPeriod

func (q *Queries) UpdateUserPeriod(ctx context.Context, arg UpdateUserPeriodParams) (User, error)

Update user role and watchlist period

func (*Queries) WithTx

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

type UpdateAdParams

type UpdateAdParams struct {
	PublisherAdKey *string    `json:"publisher_ad_key"`
	PublisherID    *int32     `json:"publisher_id"`
	PublishedAt    *time.Time `json:"published_at"`
	Category       string     `json:"category"`
	Author         *string    `json:"author"`
	Url            *string    `json:"url"`
	Title          *string    `json:"title"`
	Description    *string    `json:"description"`
	City           *string    `json:"city"`
	Neighborhood   *string    `json:"neighborhood"`
	HouseType      string     `json:"house_type"`
	Meterage       *int32     `json:"meterage"`
	RoomsCount     *int32     `json:"rooms_count"`
	Year           *int32     `json:"year"`
	Floor          *int32     `json:"floor"`
	TotalFloors    *int32     `json:"total_floors"`
	HasWarehouse   *bool      `json:"has_warehouse"`
	HasElevator    *bool      `json:"has_elevator"`
	HasParking     *bool      `json:"has_parking"`
	Lat            *float64   `json:"lat"`
	Lng            *float64   `json:"lng"`
}

type UpdateCrawlJobStatusParams

type UpdateCrawlJobStatusParams struct {
	Status string `json:"status"`
	JobID  int64  `json:"jobID"`
}

type UpdatePublisherUrlParams

type UpdatePublisherUrlParams struct {
	Url *string `json:"url"`
	ID  *int32  `json:"id"`
}

type UpdateUserPeriodParams

type UpdateUserPeriodParams struct {
	WatchlistPeriod *int32 `json:"watchlist_period"`
	TgID            string `json:"tg_id"`
}

type User

type User struct {
	TgID            string       `json:"tg_id"`
	Role            NullUserRole `json:"role"`
	WatchlistPeriod *int32       `json:"watchlist_period"`
}

type UserAd

type UserAd struct {
	ID     int64  `json:"id"`
	UserID string `json:"user_id"`
	AdID   int64  `json:"ad_id"`
}

type UserRole

type UserRole string
const (
	UserRoleSuperAdmin UserRole = "super_admin"
	UserRoleAdmin      UserRole = "admin"
	UserRoleSimple     UserRole = "simple"
)

func (*UserRole) Scan

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

Jump to

Keyboard shortcuts

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