Documentation
¶
Index ¶
- type ActiveSegment
- type ActiveSegments
- type ActiveSegmentsResponse
- type CreateSegmentRequest
- type Segment
- type SegmentAdd
- type SegmentAddDB
- type SegmentDB
- type SegmentDelete
- type SegmentDeleteDB
- type Segments
- type SegmentsDB
- type UserHistory
- type UserHistoryEntry
- type UserHistoryResponse
- type UserSegmentHistoryDB
- type UserSegmentsDB
- type UserSegmentsHistoryDB
- type UserSegmentsRequest
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ActiveSegment ¶
type ActiveSegment struct {
// the segment's slug
Slug string `json:"slug"`
}
ActiveSegment defines the structure of Segment for an API response for active user's segments
type ActiveSegments ¶
type ActiveSegments []ActiveSegment
ActiveSegments defines the structure of response for active user's segments
type ActiveSegmentsResponse ¶
type ActiveSegmentsResponse struct {
ActiveSegments ActiveSegments `json:"segments"`
}
type CreateSegmentRequest ¶
type CreateSegmentRequest struct {
// the segment's slug
//
// required: true
// min length: 5
// max length: 50
// example: AVITO_DISCOUNT_30
Slug string `json:"slug" validate:"required,min=5,max=50"`
}
CreateSegmentRequest defines the structure for an API request for adding segments swagger:model createSegmentRequest
type Segment ¶
type Segment struct {
// the id for the segment
ID int `json:"id"` // Unique identifier for the segment
// the segment's slug
Slug string `json:"slug" validate:"required,min=5,max=50"`
// is the segment deleted
IsDeleted bool `json:"is_deleted"`
}
Segment defines the structure for an API segment
type SegmentAdd ¶
type SegmentAdd struct {
// the segment's slug
//
// required: true
// min length: 5
// max length: 50
// example: AVITO_DISCOUNT_50
Slug string `json:"slug" validate:"required,min=5,max=50"`
// expiration date
//
// required: false
// example: 2025-01-02T15:04:06Z
Expired string `json:"expired,omitempty" validate:"omitempty,datetime=2006-01-02T15:04:05Z"`
}
SegmentAdd defines the structure for an API for adding segments swagger:model segmentAdd
type SegmentAddDB ¶
type SegmentAddDB struct {
// the segment's slug
Slug string
// expiration date
Expired sql.NullString
}
SegmentAddDB defines the structure for adding a segment to the database
type SegmentDB ¶
type SegmentDB struct {
// segment's id
ID int
// segment's slug
Slug string
// is the segment deleted
IsDeleted bool
}
SegmentDB defines the structure for a segment in the database
type SegmentDelete ¶
type SegmentDelete struct {
// the segment's slug
//
// required: true
// min length: 5
// max length: 50
// example: AVITO_PERFORMANCE_VAS
Slug string `json:"slug" validate:"required,min=5,max=50"`
}
SegmentDelete defines the structure for an API for deleting segments swagger:model segmentDelete
type SegmentDeleteDB ¶
type SegmentDeleteDB struct {
// the segment's slug
Slug string
}
SegmentDeleteDB defines the structure for deleting a segment from the database
type UserHistory ¶
type UserHistory []UserHistoryEntry
UserHistory defines a slice of UserHistoryEntry Implements sort.Interface
func (UserHistory) Less ¶
func (u UserHistory) Less(i, j int) bool
Less returns true if the date of the first entry is before the date of the second entry
type UserHistoryEntry ¶
type UserHistoryEntry struct {
// userID
ID int
// segment's slug
Slug string
// operation type
Operation string
// date
Date time.Time
}
UserHistoryEntry defines user's segment history entry
type UserHistoryResponse ¶
type UserHistoryResponse struct {
// link to csv file with user's segments history for specified period
Link string `json:"link"`
}
UserHistoryResponse defines the structure for an API response for getting user's segments history
type UserSegmentHistoryDB ¶
type UserSegmentHistoryDB struct {
// user's id
ID int
// segment's slug
Slug string
// date added
DateAdded time.Time
// date removed
DateRemoved sql.NullTime
}
UserSegmentHistoryDB defines the structure for a segment in the database
type UserSegmentsDB ¶
type UserSegmentsDB struct {
// user's id
ID int
// add the segments to the user
AddSegments []SegmentAddDB
// remove the segments from the user
RemoveSegments []SegmentDeleteDB
}
UserSegmentsDB defines the structure for adding and removing segments from the user
type UserSegmentsHistoryDB ¶
type UserSegmentsHistoryDB []UserSegmentHistoryDB
UserSegmentsHistoryDB defines a slice of UserSegmentHistoryDB
type UserSegmentsRequest ¶
type UserSegmentsRequest struct {
// user's id
//
// required: true
// min: 1
// max: 2147483647
// example: 42
ID int `json:"id" validate:"required,gt=0,number"`
// add the segments to the user
AddSegments []SegmentAdd `json:"add" validate:"dive"`
// remove the segments from the user
RemoveSegments []SegmentDelete `json:"remove" validate:"dive"`
}
UserSegmentsRequest defines the structure for an API for adding segments to user swagger:model userSegmentsRequest