model

package
v0.0.0-...-a32083c Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2018 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Book

type Book struct {
	ID                objectid.ObjectID `bson:"_id,omitempty" json:"_id,omitempty"`
	Author            string            `bson:"author" json:"author"`
	Genre             string            `bson:"genre" json:"genre"`
	NumberOfPages     int64             `bson:"number_of_pages" json:"number_of_pages"`
	YearOfPublication int64             `bson:"publication_year" json:"publication_year"`
	Rating            int64             `bson:"rating" json:"rating"`
}

Book book model structure

type BookFilter

type BookFilter struct {
	ID                objectid.ObjectID `bson:"_id,omitempty" json:"_id,omitempty"`
	Author            string            `bson:"author" json:"author"`
	Genre             string            `bson:"genre" json:"genre"`
	NumberOfPages     int64             `bson:"number_of_pages" json:"number_of_pages"`
	YearOfPublication int64             `bson:"publication_year" json:"publication_year"`
	Rating            int64             `bson:"rating" json:"rating"`
}

BookFilter book filter model structure

type BookRequest

type BookRequest struct {
	*Book

	ProtectedID string `json:"_id"` // override '_id' json to have more control
}

BookRequest small hack to protect ID of being posted and update from body payload

func (*BookRequest) Bind

func (b *BookRequest) Bind(r *http.Request) error

Bind bind body into book struct

type Sorting

type Sorting struct {
	// Sort field to sort
	Sort string
	// Direction one of asc, desc
	Direction int32
}

Sorting sorting structure

Jump to

Keyboard shortcuts

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