repositories

package
v0.0.0-...-946fd12 Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PropertyImages

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

func NewPropertyImages

func NewPropertyImages(db *bun.DB) PropertyImages

func (PropertyImages) Create

func (r PropertyImages) Create(ctx context.Context, image *properties.Image) error

func (PropertyImages) Delete

func (r PropertyImages) Delete(ctx context.Context, id string) error

Delete deletes image from database

func (PropertyImages) DeletePropertyImages

func (r PropertyImages) DeletePropertyImages(ctx context.Context, id int) error

DeletePropertyImages deletes images from database

func (PropertyImages) Get

func (PropertyImages) GetAll

func (r PropertyImages) GetAll(ctx context.Context, id int) ([]properties.Image, error)

func (PropertyImages) GetPropertyImage

func (r PropertyImages) GetPropertyImage(ctx context.Context, propId int, id string) (*properties.Image, error)

func (PropertyImages) GetUser

func (r PropertyImages) GetUser(ctx context.Context, propertyId int, id string) (*properties.Image, error)

type PropertyRepository

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

func NewProperty

func NewProperty(db *bun.DB) PropertyRepository

func (PropertyRepository) Create

func (r PropertyRepository) Create(ctx context.Context, property *properties.Property) error

func (PropertyRepository) Delete

func (r PropertyRepository) Delete(ctx context.Context, property *properties.Property) error

func (PropertyRepository) DeleteAll

func (r PropertyRepository) DeleteAll(ctx context.Context) error

func (PropertyRepository) Get

func (PropertyRepository) GetByUser

func (r PropertyRepository) GetByUser(ctx context.Context, id, userID int) (*properties.Property, error)

func (PropertyRepository) SearchQueryBuilder

func (r PropertyRepository) SearchQueryBuilder() SearchPropertyQueryBuilder

func (PropertyRepository) Update

func (r PropertyRepository) Update(ctx context.Context, property *properties.Property) error

func (PropertyRepository) UpdateActivity

func (r PropertyRepository) UpdateActivity(ctx context.Context, userID int, active bool) error

type PropertySearchRepository

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

func NewPropertySearch

func NewPropertySearch(db *bun.DB) PropertySearchRepository

func (PropertySearchRepository) Count

func (PropertySearchRepository) Search

func (PropertySearchRepository) SearchQueryBuilder

type SavedHomes

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

func NewSavedHomes

func NewSavedHomes(db *bun.DB) SavedHomes

func (SavedHomes) Add

func (SavedHomes) Delete

func (SavedHomes) Exists

func (r SavedHomes) Exists(ctx context.Context, home properties.UserSavedHome) (bool, error)

func (SavedHomes) List

func (r SavedHomes) List(
	ctx context.Context, userID int, pagination domain.Pagination,
) ([]properties.UserSavedHome, error)

type SearchFilters

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

func NewSearchFilters

func NewSearchFilters(db *bun.DB) SearchFilters

func (SearchFilters) Create

func (r SearchFilters) Create(ctx context.Context, search *domain.UserSearchFilters) error

func (SearchFilters) Delete

func (r SearchFilters) Delete(ctx context.Context, searchID, userID int) error

func (SearchFilters) Get

func (r SearchFilters) Get(ctx context.Context, userID, searchID int) (*domain.UserSearchFilters, error)

func (SearchFilters) List

func (r SearchFilters) List(ctx context.Context, userID int) ([]domain.UserSearchFilters, error)

func (SearchFilters) Update

func (r SearchFilters) Update(ctx context.Context, search *domain.UserSearchFilters) error

type SearchPropertyQueryBuilder

type SearchPropertyQueryBuilder interface {
	Query() *bun.SelectQuery
	SetArea(p fmt.Stringer)
	SetPaging(page, limit int)
	SetUserId(userID int)
	SetSort(sortType int)
	SetCity(city string)
	SetSortByIds(ids []int)
	SetIds(ids []int, required bool)

	SetBathroom(count uint8, exact bool)
	SetBedroom(count uint8, exact bool)

	SetPriceRange(min, max float32)
	SetLotSizeRange(min, max float32)
	SetHomeSizeRange(min, max float32)

	SetPropertyType(propertyType uint8)
	SetCondition(condition []int)
	SetHomeType(homeType []int)

	SetYearBuiltRange(min, max uint16)
	SetParking(parking *uint8)
	SetAC(hasAC *bool)

	SetActive(active bool)
}

type SearchQueryBuilder

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

func NewSearchQueryBuilder

func NewSearchQueryBuilder(query *bun.SelectQuery) *SearchQueryBuilder

func (*SearchQueryBuilder) Query

func (q *SearchQueryBuilder) Query() *bun.SelectQuery

func (*SearchQueryBuilder) SetAC

func (q *SearchQueryBuilder) SetAC(hasAC *bool)

func (*SearchQueryBuilder) SetActive

func (q *SearchQueryBuilder) SetActive(active bool)

SetActive filters only active properties

func (*SearchQueryBuilder) SetArea

func (q *SearchQueryBuilder) SetArea(p fmt.Stringer)

func (*SearchQueryBuilder) SetBathroom

func (q *SearchQueryBuilder) SetBathroom(count uint8, exact bool)

func (*SearchQueryBuilder) SetBedroom

func (q *SearchQueryBuilder) SetBedroom(count uint8, exact bool)

func (*SearchQueryBuilder) SetCity

func (q *SearchQueryBuilder) SetCity(city string)

func (*SearchQueryBuilder) SetCondition

func (q *SearchQueryBuilder) SetCondition(condition []int)

func (*SearchQueryBuilder) SetHomeSizeRange

func (q *SearchQueryBuilder) SetHomeSizeRange(min, max float32)

func (*SearchQueryBuilder) SetHomeType

func (q *SearchQueryBuilder) SetHomeType(homeType []int)

func (*SearchQueryBuilder) SetIds

func (q *SearchQueryBuilder) SetIds(ids []int, required bool)

func (*SearchQueryBuilder) SetLotSizeRange

func (q *SearchQueryBuilder) SetLotSizeRange(min, max float32)

func (*SearchQueryBuilder) SetPaging

func (q *SearchQueryBuilder) SetPaging(page, limit int)

func (*SearchQueryBuilder) SetParking

func (q *SearchQueryBuilder) SetParking(parking *uint8)

func (*SearchQueryBuilder) SetPriceRange

func (q *SearchQueryBuilder) SetPriceRange(min, max float32)

func (*SearchQueryBuilder) SetPropertyType

func (q *SearchQueryBuilder) SetPropertyType(propertyType uint8)

func (*SearchQueryBuilder) SetSort

func (q *SearchQueryBuilder) SetSort(sort int)

func (*SearchQueryBuilder) SetSortByIds

func (q *SearchQueryBuilder) SetSortByIds(ids []int)

func (*SearchQueryBuilder) SetUserId

func (q *SearchQueryBuilder) SetUserId(userID int)

func (*SearchQueryBuilder) SetYearBuiltRange

func (q *SearchQueryBuilder) SetYearBuiltRange(min, max uint16)

type SimilarPropertyQueryBuilder

type SimilarPropertyQueryBuilder interface {
	Query() *bun.SelectQuery
	SetAreaWithin(p fmt.Stringer, distanceMeters int)

	SetNotIds(ids []int)
	SetLimit(num int)
	SetMinBedroom(count uint8)
	SetPriceRange(min, max float32)
	SetHomeSizeRange(min, max float32)
	SetPropertyType(propertyType uint8)
	SetActive(active bool)
}

type SimilarPropertySearchRepository

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

func NewSimilarPropertySearch

func NewSimilarPropertySearch(db *bun.DB) SimilarPropertySearchRepository

func (SimilarPropertySearchRepository) Count

func (SimilarPropertySearchRepository) Search

func (SimilarPropertySearchRepository) SearchQueryBuilder

type SimilarSearchQueryBuilder

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

func NewSimilarSearchQueryBuilder

func NewSimilarSearchQueryBuilder(query *bun.SelectQuery) *SimilarSearchQueryBuilder

func (*SimilarSearchQueryBuilder) Query

func (*SimilarSearchQueryBuilder) SetActive

func (q *SimilarSearchQueryBuilder) SetActive(active bool)

SetActive filters only active properties

func (*SimilarSearchQueryBuilder) SetAreaWithin

func (q *SimilarSearchQueryBuilder) SetAreaWithin(p fmt.Stringer, distanceMeters int)

func (*SimilarSearchQueryBuilder) SetHomeSizeRange

func (q *SimilarSearchQueryBuilder) SetHomeSizeRange(min, max float32)

func (*SimilarSearchQueryBuilder) SetLimit

func (q *SimilarSearchQueryBuilder) SetLimit(limit int)

func (*SimilarSearchQueryBuilder) SetMinBedroom

func (q *SimilarSearchQueryBuilder) SetMinBedroom(count uint8)

func (*SimilarSearchQueryBuilder) SetNotIds

func (q *SimilarSearchQueryBuilder) SetNotIds(ids []int)

func (*SimilarSearchQueryBuilder) SetPriceRange

func (q *SimilarSearchQueryBuilder) SetPriceRange(min, max float32)

func (*SimilarSearchQueryBuilder) SetPropertyType

func (q *SimilarSearchQueryBuilder) SetPropertyType(propertyType uint8)

type UserRepository

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

func NewUser

func NewUser(db *bun.DB) UserRepository

func (UserRepository) Create

func (r UserRepository) Create(ctx context.Context, user domain.User, token domain.UserTokenAction) error

Create creates a new user in the database.

func (UserRepository) CreateUser

func (r UserRepository) CreateUser(ctx context.Context, user *domain.User) error

Create creates a new user in the database.

func (UserRepository) Delete

func (r UserRepository) Delete(ctx context.Context, id int) error

Delete deletes a user with the given ID from the database.

func (UserRepository) EmailExists

func (r UserRepository) EmailExists(ctx context.Context, email string) (bool, error)

EmailExists check if email exists in db

func (UserRepository) Get

func (r UserRepository) Get(ctx context.Context, id int) (*domain.User, error)

Get retrieves a user with the given ID from the database.

func (UserRepository) GetByEmail

func (r UserRepository) GetByEmail(ctx context.Context, email string) (*domain.User, error)

GetByEmail retrieves a user with the given email address from the database.

func (UserRepository) List

func (r UserRepository) List(ctx context.Context, limit, offset int) ([]*domain.User, error)

List retrieves a list of users from the database.

func (UserRepository) SetNewPwd

func (r UserRepository) SetNewPwd(ctx context.Context, user *domain.User) error

SetNewPwd sets new password for user

func (UserRepository) Update

func (r UserRepository) Update(ctx context.Context, user *domain.User) error

Update updates an existing user in the database.

func (UserRepository) UpdateActivity

func (r UserRepository) UpdateActivity(ctx context.Context, userID int, active bool) error

UpdateActivity deactivates an existing user in the database.

type UserTokenActionRepo

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

func NewUserTokenAction

func NewUserTokenAction(db *bun.DB) UserTokenActionRepo

func (UserTokenActionRepo) Create

func (r UserTokenActionRepo) Create(ctx context.Context, tokenAction *domain.UserTokenAction) error

func (UserTokenActionRepo) Delete

func (r UserTokenActionRepo) Delete(ctx context.Context, token string) error

func (UserTokenActionRepo) GetByToken

func (r UserTokenActionRepo) GetByToken(ctx context.Context, token string) (*domain.UserTokenAction, error)

func (UserTokenActionRepo) Update

func (r UserTokenActionRepo) Update(ctx context.Context, tokenAction *domain.UserTokenAction) error

Jump to

Keyboard shortcuts

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