controller

package
v0.0.0-...-271498a Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2022 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AccessResource

func AccessResource(c *gin.Context)

AccessResource - can be accessed by basic auth

func AddHobby

func AddHobby(c *gin.Context)

AddHobby - PUT /users/hobbies

func CreatePost

func CreatePost(c *gin.Context)

CreatePost - POST /posts

func CreateUser

func CreateUser(c *gin.Context)

CreateUser - POST /users

func CreateUserAuth

func CreateUserAuth(c *gin.Context)

CreateUserAuth - POST /register

func DeletePost

func DeletePost(c *gin.Context)

DeletePost - DELETE /posts/:id

func GetHobbies

func GetHobbies(c *gin.Context)

GetHobbies - GET /hobbies

func GetPost

func GetPost(c *gin.Context)

GetPost - GET /posts/:id

func GetPosts

func GetPosts(c *gin.Context)

GetPosts - GET /posts

func GetUser

func GetUser(c *gin.Context)

GetUser - GET /users/:id

func GetUsers

func GetUsers(c *gin.Context)

GetUsers - GET /users

func Login

func Login(c *gin.Context)

Login ...

func MongoCreateOne

func MongoCreateOne(c *gin.Context)

MongoCreateOne - create one document

func MongoDeleteByID

func MongoDeleteByID(c *gin.Context)

MongoDeleteByID - delete one document by ID

func MongoDeleteFieldByID

func MongoDeleteFieldByID(c *gin.Context)

MongoDeleteFieldByID - delete existing field(s) from a document

func MongoFilter

func MongoFilter(geocoding Geocoding, addDocIDInFilter bool) bson.M

MongoFilter - search filter

func MongoGetAll

func MongoGetAll(c *gin.Context)

MongoGetAll - get all documents

func MongoGetByFilter

func MongoGetByFilter(c *gin.Context)

MongoGetByFilter - find documents using filter

func MongoGetByID

func MongoGetByID(c *gin.Context)

MongoGetByID - find one document by ID

func MongoUpdateByID

func MongoUpdateByID(c *gin.Context)

MongoUpdateByID - update a document edit existing fields add new fields do not remove any existing field

func RedisCreate

func RedisCreate(c *gin.Context)

RedisCreate - SET key

func RedisCreateHash

func RedisCreateHash(c *gin.Context)

RedisCreateHash - SET hashes

func RedisDelete

func RedisDelete(c *gin.Context)

RedisDelete - DEL key

func RedisDeleteHash

func RedisDeleteHash(c *gin.Context)

RedisDeleteHash - DEL hashes

func RedisRead

func RedisRead(c *gin.Context)

RedisRead - GET key

func RedisReadHash

func RedisReadHash(c *gin.Context)

RedisReadHash - GET hashes

func Refresh

func Refresh(c *gin.Context)

Refresh ...

func UpdatePost

func UpdatePost(c *gin.Context)

UpdatePost - PUT /posts/:id

func UpdateUser

func UpdateUser(c *gin.Context)

UpdateUser - PUT /users

Types

type Geocoding

type Geocoding struct {
	ID               primitive.ObjectID `json:"id" bson:"_id"`
	FormattedAddress string             `json:"formatted_address,omitempty" bson:"formatted_address,omitempty"`
	StreetName       string             `json:"street_name,omitempty" bson:"street_name,omitempty"`
	HouseNumber      string             `json:"house_number,omitempty" bson:"house_number,omitempty"`
	PostalCode       string             `json:"postal_code,omitempty" bson:"postal_code,omitempty"`
	County           string             `json:"county,omitempty" bson:"county,omitempty"`
	City             string             `json:"city,omitempty" bson:"city,omitempty"`
	State            string             `json:"state,omitempty" bson:"state,omitempty"`
	StateCode        string             `json:"state_code,omitempty" bson:"state_code,omitempty"`
	Country          string             `json:"country,omitempty" bson:"country,omitempty"`
	CountryCode      string             `json:"country_code,omitempty" bson:"country_code,omitempty"`
	Geometry         Geometry           `json:"geometry,omitempty" bson:"inline"`
}

Geocoding - struct for address

func MongoTrimSpace

func MongoTrimSpace(geocoding Geocoding) Geocoding

MongoTrimSpace - remove all leading and trailing white spaces

type Geometry

type Geometry struct {
	Latitude  float64 `json:"lat,omitempty" bson:"lat,omitempty"`
	Longitude float64 `json:"lng,omitempty" bson:"lng,omitempty"`
}

Geometry - struct for latitude and longitude

type LoginPayload

type LoginPayload struct {
	Email    string `json:"Email"`
	Password string `json:"Password"`
}

LoginPayload ...

type RedisData

type RedisData struct {
	Key   string `json:"Key"`
	Value string `json:"Value"`
}

RedisData - key:value

type RedisDataHash

type RedisDataHash struct {
	Key   string `json:"Key"`
	Value RedisDataHashValue
}

RedisDataHash - key:hashValues

type RedisDataHashValue

type RedisDataHashValue struct {
	Value1 string `json:"Value1"`
	Value2 string `json:"Value2"`
	Value3 string `json:"Value3"`
	Value4 string `json:"Value4"`
}

RedisDataHashValue - values

Jump to

Keyboard shortcuts

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