Documentation ¶
Index ¶
- Variables
- type Advert
- func (a Advert) Activate(ctx context.Context, traceID string, id string) (AdvertInfo, error)
- func (a Advert) Create(ctx context.Context, traceID string, na NewAdvert, now time.Time) (Info, error)
- func (a Advert) Deactivate(ctx context.Context, traceID string, id string) (AdvertInfo, error)
- func (a Advert) Query(ctx context.Context, traceID string, limit int, offset int, ...) ([]AdvertInfo, error)
- func (a Advert) QueryByID(ctx context.Context, traceID string, advertID string) (AdvertInfo, error)
- func (a Advert) TotalActive(ctx context.Context, traceID string) (int, error)
- type AdvertInfo
- type Info
- type NewAdvert
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrNotFound is used when a specific User is requested but does not exist. ErrNotFound = errors.New("not found") // ErrInvalidID occurs when an ID is not in a valid form. ErrInvalidID = errors.New("ID is not in its proper form") )
Functions ¶
This section is empty.
Types ¶
type Advert ¶
type Advert struct {
// contains filtered or unexported fields
}
Advert ...
func (Advert) Create ¶
func (a Advert) Create(ctx context.Context, traceID string, na NewAdvert, now time.Time) (Info, error)
Create creates new advert
func (Advert) Deactivate ¶
Deactivate deactivate advert.
func (Advert) Query ¶
func (a Advert) Query(ctx context.Context, traceID string, limit int, offset int, filters map[string][]string) ([]AdvertInfo, error)
Query retrieves a list of existing categories from the database.
type AdvertInfo ¶
type AdvertInfo struct { ID string `db:"uuid" json:"id"` UserID string `db:"user_uuid" json:"user_uuid"` CategoryID string `db:"category_uuid" json:"category_uuid"` Title string `db:"title" json:"title"` Description string `db:"description" json:"description"` Location string `db:"location" json:"location"` Price int `db:"price" json:"price"` IsActive bool `db:"is_active" json:"is_active"` Created time.Time `db:"created" json:"created"` Updated time.Time `db:"updated" json:"updated"` UserInfo user.UserInfo `db:"user" json:"user"` CategoryInfo category.CategoryInfo `db:"category" json:"category"` }
AdvertInfo represent an individual advert.
type Info ¶
type Info struct { ID string `db:"uuid" json:"id"` UserID string `db:"user_uuid" json:"user_uuid"` CategoryID string `db:"category_uuid" json:"category_uuid"` Title string `db:"title" json:"title"` Description string `db:"description" json:"description"` Location string `db:"location" json:"location"` Price int `db:"price" json:"price"` IsActive bool `db:"is_active" json:"is_active"` Created time.Time `db:"created" json:"created"` Updated time.Time `db:"updated" json:"updated"` }
Info represent an individual advert.
type NewAdvert ¶
type NewAdvert struct { UserID string `db:"user_uuid" json:"user_uuid"` CategoryID string `db:"category_uuid" json:"category_uuid"` Title string `db:"title" json:"title"` Description string `db:"description" json:"description"` Location string `db:"location" json:"location"` Price int `db:"price" json:"price"` }
NewAdvert represent an individual advert.
Click to show internal directories.
Click to hide internal directories.