service

package
v0.0.0-...-d78a86b Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2021 License: BSD-3-Clause Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func All

func All() error

func CreateOne

func CreateOne(object interface{}, col string, args ...Page) (*mongo.InsertOneResult, error)

func CreateUser

func CreateUser(user interface{}) (primitive.ObjectID, error)

func DeleteOne

func DeleteOne(object interface{}, col string) (*mongo.DeleteResult, error)

func DeleteUser

func DeleteUser() error

func GetAll

func GetAll(page Page) ([]bson.M, error)

func GetOne

func GetOne(object *interface{}, col string) (bson.M, error)

func GetUser

func GetUser(user interface{}) (model.User, error)

func HealthcheckHandler

func HealthcheckHandler(w http.ResponseWriter, r *http.Request)

HealthcheckHandler returns the date and time

func UpdateOne

func UpdateOne(object interface{}, newObject interface{}, col string) (*mongo.UpdateResult, error)

func UpdateUser

func UpdateUser(filter bson.D, update bson.D) (*mongo.UpdateResult, error)

func UserHandler

func UserHandler(writer http.ResponseWriter, h *http.Request)

Types

type Data

type Data struct {
	Id primitive.ObjectID `faker:"-" json:"_id,omitempty" bson:"_id,omitempty"`
}

type Page

type Page struct {
	Limit      int64  `json:"limit",bson:"limit"`
	LastId     string `json:"last_id",bson:"last_id"`
	Asc        bool   `json:"asc",bson:"asc"`
	Collection string
	Model      interface{}
}

type Response

type Response struct {
	Token  string      `json:"token"`
	Status string      `json:"status"`
	Data   interface{} `json:"data"`
}

Response is a representation of JSON response for JWT

Jump to

Keyboard shortcuts

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