controller

package
v0.0.0-...-f03831e Latest Latest
Warning

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

Go to latest
Published: Jan 17, 2022 License: MPL-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HandleQuery

func HandleQuery(c *gin.Context, collection string, db *mongo.Database)

HandleQuery @Summary Get Temperature/Humidity Records by Date @Description get Temperature/Humidity by date @Tags MQTTRecords @Produce json @Param data body DateRangeRequest true "Request Body" @Success 200 {object} ResponseMsg @Failure 400 {object} ErrorMsg @Failure 500 {object} ErrorMsg @Router /temperature [post] @Router /humidity [post]

func HandleQueryByPage

func HandleQueryByPage(c *gin.Context, collection string, db *mongo.Database)

HandleQueryByPage @Summary Get Temperature/Humidity Records by Page @Description get Temperature/Humidity by page @Tags MQTTRecords @Produce json @Param page query int false "From 1 to infinity" @Success 200 {object} ResponseMsg @Failure 400 {object} ErrorMsg @Failure 500 {object} ErrorMsg @Router /temperature [get] @Router /humidity [get]

Types

type Chain33Info

type Chain33Info struct {
	PrivKey string `json:"priv_key" example:"cc38546e9e659d15e6b4893f0ab32a06d103931a8230b0bde71459d2b27d6944"`
	Url     string `json:"url" example:"http://127.0.0.1:8801"`
}

Chain33Info Optional

type DateRangeRequest

type DateRangeRequest struct {
	// Page is from 1 to infinity
	Page *int64 `json:"page,omitempty" example:"1"`
	// Time RFC3339
	Start *string `json:"start" example:"2020-01-01T00:00:00Z" validate:"required"`
	// Time RFC3339
	End       *string      `json:"end,omitempty" example:"2022-01-01T00:00:00Z"`
	Info      *Chain33Info `json:"chain,omitempty"`
	IsDescend *bool        `json:"descend,omitempty" example:"true"`
}

type ErrorMsg

type ErrorMsg struct {
	// Error message
	Err string `json:"error" example:"error message"`
}

type ResponseMsg

type ResponseMsg struct {
	Records []model.MQTTRecord `json:"records"`
}

Jump to

Keyboard shortcuts

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