Documentation ¶
Index ¶
Constants ¶
View Source
const ( MONGO_USER_KEY = "MONGO_USERNAME" MONGO_PWD_KEY = "MONGO_PWD" )
Variables ¶
This section is empty.
Functions ¶
func GetClientConnection ¶
Types ¶
type CreateItemRequest ¶
type CreateItemRequest struct { Owner string `json:"owner,omitempty" bson:"owner,omitempty"` Name string `json:"name,omitempty" bson:"name,omitempty"` Price float64 `json:"price,omitempty" bson:"price,omitempty"` Quantity int `json:"quantity,omitempty" bson:"quantity,omitempty"` Tags []string `json:"tags,omitempty" bson:"tags,omitempty"` }
type CreateItemResponse ¶
type CreateItemResponse struct { ObjectID primitive.ObjectID `bson:"_id" json:"_id"` Owner string `json:"owner,omitempty" bson:"owner,omitempty"` Name string `json:"name,omitempty" bson:"name,omitempty"` Price float64 `json:"price,omitempty" bson:"price,omitempty"` Quantity int `json:"quantity,omitempty" bson:"quantity,omitempty"` Tags []string `json:"tags,omitempty" bson:"tags,omitempty"` }
type ErrorResponse ¶
type ErrorResponse struct {
Message string `json:"message"`
}
type Repository ¶
type Repository interface { Create(ctx context.Context, in *CreateItemRequest) (*CreateItemResponse, error) Retrieve(ctx context.Context, id string) (*RetrieveItemResponse, error) Update(ctx context.Context, id string, in *UpdateItemRequest) (*UpdateItemResponse, error) Delete(ctx context.Context, id string) error }
func NewRepoManager ¶
func NewRepoManager(items *mongo.Collection) Repository
type RetrieveItemResponse ¶
type RetrieveItemResponse struct { ObjectID primitive.ObjectID `bson:"_id" json:"_id"` Owner string `json:"owner,omitempty" bson:"owner,omitempty"` Name string `json:"name,omitempty" bson:"name,omitempty"` Price float64 `json:"price,omitempty" bson:"price,omitempty"` Quantity int `json:"quantity,omitempty" bson:"quantity,omitempty"` Tags []string `json:"tags,omitempty" bson:"tags,omitempty"` }
type Service ¶
type Service interface { Ping(c echo.Context) error Create(c echo.Context) error Retrieve(c echo.Context) error Update(c echo.Context) error Delete(c echo.Context) error }
func NewService ¶
func NewService(log echo.Logger, repo Repository) Service
type UpdateItemRequest ¶
type UpdateItemRequest struct { Owner string `json:"owner,omitempty" bson:"owner,omitempty"` Name string `json:"name,omitempty" bson:"name,omitempty"` Price float64 `json:"price,omitempty" bson:"price,omitempty"` Quantity int `json:"quantity,omitempty" bson:"quantity,omitempty"` Tags []string `json:"tags,omitempty" bson:"tags,omitempty"` }
type UpdateItemResponse ¶
type UpdateItemResponse struct { ObjectID primitive.ObjectID `bson:"_id" json:"_id"` Owner string `json:"owner,omitempty" bson:"owner,omitempty"` Name string `json:"name,omitempty" bson:"name,omitempty"` Price float64 `json:"price,omitempty" bson:"price,omitempty"` Quantity int `json:"quantity,omitempty" bson:"quantity,omitempty"` Tags []string `json:"tags,omitempty" bson:"tags,omitempty"` }
Click to show internal directories.
Click to hide internal directories.