models

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2023 License: MIT Imports: 2 Imported by: 0

Documentation

Index

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 Segments

type Segments []Segment

Segments defines a slice of Segment

type SegmentsDB

type SegmentsDB []SegmentDB

SegmentsDB defines a slice of SegmentDB

type UserHistory

type UserHistory []UserHistoryEntry

UserHistory defines a slice of UserHistoryEntry Implements sort.Interface

func (UserHistory) Len

func (u UserHistory) Len() int

Len returns the length of UserHistory

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

func (UserHistory) Swap

func (u UserHistory) Swap(i, j int)

Swap swaps the entries

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

Jump to

Keyboard shortcuts

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