This commit is contained in:
saeid_01 2023-10-30 03:03:40 +03:30
parent 2d08aee582
commit 321381c8d7
27 changed files with 1462 additions and 108 deletions

View File

@ -20,48 +20,82 @@ func NewProductController(svc domain.ProductService) *controller {
}
}
// ListProducts godoc
// @Summary List Products
// @Description get Products
// @Tags Products
// @Accept json
// @Produce json
// @Param q query string false "name search by q" Format(email)
// @Success 200 {array} entity.ProductDisplay
// @Failure 400 {object} httputil.HTTPError
// @Failure 500 {object} httputil.HTTPError
// @Router /products [get]
func (c *controller) listProduct(ctx *gin.Context) {
products, err := c.service.List()
if err != nil {
utils.ResponseJSON(ctx, http.StatusOK, http.StatusBadRequest, err.Error(), nil)
utils.ResponseJSON(ctx, http.StatusBadRequest, err.Error(), nil)
return
}
utils.ResponseJSON(ctx, http.StatusOK, http.StatusOK, "successful", products)
utils.ResponseJSON(ctx, http.StatusOK, "successful", products)
}
// ShowProduct godoc
// @Summary Show an product
// @Description get string by ID
// @Tags Products
// @Accept json
// @Produce json
// @Param id path int true "product ID"
// @Success 200 {object} entity.ProductDisplay
// @Failure 404 {object} httputil.HTTPError
// @Failure 500 {object} httputil.HTTPError
// @Router /products/{id} [get]
func (c *controller) getProduct(ctx *gin.Context) {
id := ctx.Param("id")
id_convert, err := strconv.Atoi(id)
if err != nil {
utils.ResponseJSON(ctx, http.StatusOK, http.StatusNotFound, err.Error(), nil)
utils.ResponseJSON(ctx, http.StatusNotFound, err.Error(), nil)
return
}
product, err := c.service.GetByID(id_convert)
if err != nil || product == nil {
utils.ResponseJSON(ctx, http.StatusOK, http.StatusBadRequest, err.Error(), nil)
utils.ResponseJSON(ctx, http.StatusNotFound, err.Error(), nil)
return
}
utils.ResponseJSON(ctx, http.StatusOK, http.StatusFound, "successful", product)
utils.ResponseJSON(ctx, http.StatusOK, "successful", product)
}
// UpdateProduct godoc
// @Summary Update an product
// @Description update Product by ID
// @Tags Products
// @Accept json
// @Produce json
// @Param id path int true "product ID"
// @Success 200 string message
// @Failure 400 {object} httputil.HTTPError
// @Failure 404 {object} httputil.HTTPError
// @Failure 500 {object} httputil.HTTPError
// @Router /products/{id} [put]
func (c *controller) update(ctx *gin.Context) {
var data *entity.ProductCreateUpdate
var id = ctx.Param("id")
id_convert, err := strconv.Atoi(id)
if err != nil {
utils.ResponseJSON(ctx, http.StatusOK, http.StatusNotFound, err.Error(), nil)
utils.ResponseJSON(ctx, http.StatusNotFound, err.Error(), nil)
return
}
if err := ctx.ShouldBindJSON(&data); err != nil {
utils.ResponseJSON(ctx, http.StatusOK, http.StatusBadRequest, err.Error(), nil)
utils.ResponseJSON(ctx, http.StatusBadRequest, err.Error(), nil)
return
}
product, err := c.service.GetByID(id_convert)
if err != nil || product == nil {
utils.ResponseJSON(ctx, http.StatusOK, http.StatusBadRequest, entity.ErrNotFound.Error(), nil)
utils.ResponseJSON(ctx, http.StatusNotFound, entity.ErrNotFound.Error(), nil)
return
}
@ -69,31 +103,43 @@ func (c *controller) update(ctx *gin.Context) {
err = c.service.Update(data)
if err != nil {
utils.ResponseJSON(ctx, http.StatusOK, http.StatusBadRequest, err.Error(), nil)
utils.ResponseJSON(ctx, http.StatusBadRequest, err.Error(), nil)
return
}
response := entity.ProductDisplayFormatter(data)
utils.ResponseJSON(ctx, http.StatusOK, http.StatusAccepted, "successful", response)
utils.ResponseJSON(ctx, http.StatusAccepted, "successful", response)
}
// DeleteProduct godoc
// @Summary Delete an product
// @Description Delete Product by ID
// @Tags Products
// @Accept json
// @Produce json
// @Param id path int true "product ID"
// @Success 200 string successfully deleted
// @Failure 404 {object} httputil.HTTPError
// @Failure 400 {object} httputil.HTTPError
// @Failure 500 {object} httputil.HTTPError
// @Router /products/{id} [delete]
func (c *controller) deleteProduct(ctx *gin.Context) {
var id = ctx.Param("id")
id_convert, err := strconv.Atoi(id)
if err != nil {
utils.ResponseJSON(ctx, http.StatusOK, http.StatusNotFound, err.Error(), nil)
utils.ResponseJSON(ctx, http.StatusNotFound, err.Error(), nil)
return
}
product, err := c.service.GetByID(id_convert)
if err != nil || product == nil {
utils.ResponseJSON(ctx, http.StatusOK, http.StatusBadRequest, entity.ErrNotFound.Error(), nil)
utils.ResponseJSON(ctx, http.StatusNotFound, entity.ErrNotFound.Error(), nil)
return
}
err = c.service.Delete(id_convert)
if err != nil {
utils.ResponseJSON(ctx, http.StatusOK, http.StatusBadRequest, err.Error(), nil)
utils.ResponseJSON(ctx, http.StatusBadRequest, err.Error(), nil)
return
}
utils.ResponseJSON(ctx, http.StatusOK, http.StatusAccepted, "successfully deleted", nil)
utils.ResponseJSON(ctx, http.StatusAccepted, "successfully deleted", nil)
}

View File

@ -1,36 +1,28 @@
package middlewares
import (
"net/http"
jwttoken "online-order/utils/jwt_token"
"github.com/gin-gonic/gin"
"online-order/domain"
)
type controller struct {
service domain.AuthService
//service domain.AuthService
}
func NewMiddlewareControllers(svc domain.AuthService) *controller {
return &controller{
service: svc,
}
}
func (cont *controller) JwAuthtMiddleware() gin.HandlerFunc {
return func(c *gin.Context) {
user_id, err := jwttoken.IsTokenValid(c)
if err != nil {
c.AbortWithStatusJSON(http.StatusUnauthorized, gin.H{"message": "Unauthorized. Please Login first", "code": 401, "details": err.Error()})
return
}
user, _, err := cont.service.GetByID(user_id)
if err != nil || user == nil {
c.AbortWithStatusJSON(http.StatusUnauthorized, gin.H{"message": "Unauthorized. User not found", "code": 401, "details": err.Error()})
return
}
c.Next()
}
}
//func NewMiddlewareControllers(svc domain.AuthService) *controller {
// return &controller{
// service: svc,
// }
//}
//
//func (cont *controller) JwAuthtMiddleware() gin.HandlerFunc {
// return func(c *gin.Context) {
// user_id, err := jwttoken.IsTokenValid(c)
// if err != nil {
// c.AbortWithStatusJSON(http.StatusUnauthorized, gin.H{"message": "Unauthorized. Please Login first", "code": 401, "details": err.Error()})
// return
// }
//
// user, _, err := cont.service.GetByID(user_id)
// if err != nil || user == nil {
// c.AbortWithStatusJSON(http.StatusUnauthorized, gin.H{"message": "Unauthorized. User not found", "code": 401, "details": err.Error()})
// return
// }
// c.Next()
// }
//}

View File

@ -1,13 +1,8 @@
package middlewares
import (
"online-order/entity"
"online-order/repository/product"
)
//func NewMiddlewareRouters(server *entity.Routers) *controller {
//productRepo := repository_product.NewProductClient(server.Database)
//authService := service_authentication.NewAuthService(productRepo)
func NewMiddlewareRouters(server *entity.Routers) *controller {
productRepo := repository_product.NewProductClient(server.Database)
authService := service_authentication.NewAuthService(productRepo)
return NewMiddlewareControllers(authService)
}
//return NewMiddlewareControllers(authService)
//}

View File

@ -0,0 +1,45 @@
package middlewares
import (
"github.com/gin-gonic/gin"
"log"
"net/http"
"online-order/configs"
"online-order/domain"
"online-order/entity"
repository_domain "online-order/repository/domain"
service_domain "online-order/usecase/domain"
"strings"
)
func DomainMiddleware(server *entity.Routers) gin.HandlerFunc {
return func(c *gin.Context) {
// get domain from request
conf := configs.LoadConfigEnv()
hostName := strings.Replace(c.Request.Host, "www.", "", 1)
domainName := strings.Replace(hostName, ":"+conf.ServerPort, "", 1)
if domainName == "" {
c.JSON(http.StatusBadRequest, gin.H{"error": "domain not valid"})
c.Abort()
return
}
domainRepo := repository_domain.NewDomainClient(server.Database)
domainService := service_domain.NewDomainService(domainRepo)
// get domain from database
domainModel, err := domain.DomainService.GetByDomain(domainService, domainName)
log.Printf("domainModel name: %v", domainModel)
if err != nil {
c.JSON(http.StatusNotFound, gin.H{"error": "domain not Found"})
c.Abort()
return
}
c.Set("domain", domainModel)
c.Next()
}
}

289
docs/docs.go Normal file
View File

@ -0,0 +1,289 @@
// Package docs Code generated by swaggo/swag. DO NOT EDIT
package docs
import "github.com/swaggo/swag"
const docTemplate = `{
"schemes": {{ marshal .Schemes }},
"swagger": "2.0",
"info": {
"description": "{{escape .Description}}",
"title": "{{.Title}}",
"termsOfService": "http://swagger.io/terms/",
"contact": {
"name": "API Support",
"url": "http://www.swagger.io/support",
"email": "support@swagger.io"
},
"license": {
"name": "Apache 2.0",
"url": "http://www.apache.org/licenses/LICENSE-2.0.html"
},
"version": "{{.Version}}"
},
"host": "{{.Host}}",
"basePath": "{{.BasePath}}",
"paths": {
"/products": {
"get": {
"description": "get Products",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Products"
],
"summary": "List Products",
"parameters": [
{
"type": "string",
"format": "email",
"description": "name search by q",
"name": "q",
"in": "query"
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/entity.ProductDisplay"
}
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/httputil.HTTPError"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/httputil.HTTPError"
}
}
}
}
},
"/products/{id}": {
"get": {
"description": "get string by ID",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Products"
],
"summary": "Show an product",
"parameters": [
{
"type": "integer",
"description": "product ID",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/entity.ProductDisplay"
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/httputil.HTTPError"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/httputil.HTTPError"
}
}
}
},
"put": {
"description": "update Product by ID",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Products"
],
"summary": "Update an product",
"parameters": [
{
"type": "integer",
"description": "product ID",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "string"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/httputil.HTTPError"
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/httputil.HTTPError"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/httputil.HTTPError"
}
}
}
},
"delete": {
"description": "Delete Product by ID",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Products"
],
"summary": "Delete an product",
"parameters": [
{
"type": "integer",
"description": "product ID",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "string"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/httputil.HTTPError"
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/httputil.HTTPError"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/httputil.HTTPError"
}
}
}
}
}
},
"definitions": {
"entity.ProductDisplay": {
"type": "object",
"properties": {
"created_at": {
"type": "string"
},
"description": {
"type": "string"
},
"id": {
"type": "integer"
},
"name": {
"type": "string"
},
"original_price": {
"type": "number"
},
"price": {
"type": "number"
},
"quantity": {
"type": "integer"
},
"status": {
"type": "boolean"
},
"updated_at": {
"type": "string"
}
}
},
"httputil.HTTPError": {
"type": "object",
"properties": {
"code": {
"type": "integer",
"example": 400
},
"message": {
"type": "string",
"example": "status bad request"
}
}
}
},
"securityDefinitions": {
"BasicAuth": {
"type": "basic"
}
},
"externalDocs": {
"description": "OpenAPI",
"url": "https://swagger.io/resources/open-api/"
}
}`
// SwaggerInfo holds exported Swagger Info so clients can modify it
var SwaggerInfo = &swag.Spec{
Version: "1.0",
Host: "localhost:9000",
BasePath: "/api/v1",
Schemes: []string{},
Title: "Swagger Example API",
Description: "This is a sample server celler server.",
InfoInstanceName: "swagger",
SwaggerTemplate: docTemplate,
LeftDelim: "{{",
RightDelim: "}}",
}
func init() {
swag.Register(SwaggerInfo.InstanceName(), SwaggerInfo)
}

265
docs/swagger.json Normal file
View File

@ -0,0 +1,265 @@
{
"swagger": "2.0",
"info": {
"description": "This is a sample server celler server.",
"title": "Swagger Example API",
"termsOfService": "http://swagger.io/terms/",
"contact": {
"name": "API Support",
"url": "http://www.swagger.io/support",
"email": "support@swagger.io"
},
"license": {
"name": "Apache 2.0",
"url": "http://www.apache.org/licenses/LICENSE-2.0.html"
},
"version": "1.0"
},
"host": "localhost:9000",
"basePath": "/api/v1",
"paths": {
"/products": {
"get": {
"description": "get Products",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Products"
],
"summary": "List Products",
"parameters": [
{
"type": "string",
"format": "email",
"description": "name search by q",
"name": "q",
"in": "query"
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/entity.ProductDisplay"
}
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/httputil.HTTPError"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/httputil.HTTPError"
}
}
}
}
},
"/products/{id}": {
"get": {
"description": "get string by ID",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Products"
],
"summary": "Show an product",
"parameters": [
{
"type": "integer",
"description": "product ID",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/entity.ProductDisplay"
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/httputil.HTTPError"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/httputil.HTTPError"
}
}
}
},
"put": {
"description": "update Product by ID",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Products"
],
"summary": "Update an product",
"parameters": [
{
"type": "integer",
"description": "product ID",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "string"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/httputil.HTTPError"
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/httputil.HTTPError"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/httputil.HTTPError"
}
}
}
},
"delete": {
"description": "Delete Product by ID",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Products"
],
"summary": "Delete an product",
"parameters": [
{
"type": "integer",
"description": "product ID",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "string"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/httputil.HTTPError"
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/httputil.HTTPError"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/httputil.HTTPError"
}
}
}
}
}
},
"definitions": {
"entity.ProductDisplay": {
"type": "object",
"properties": {
"created_at": {
"type": "string"
},
"description": {
"type": "string"
},
"id": {
"type": "integer"
},
"name": {
"type": "string"
},
"original_price": {
"type": "number"
},
"price": {
"type": "number"
},
"quantity": {
"type": "integer"
},
"status": {
"type": "boolean"
},
"updated_at": {
"type": "string"
}
}
},
"httputil.HTTPError": {
"type": "object",
"properties": {
"code": {
"type": "integer",
"example": 400
},
"message": {
"type": "string",
"example": "status bad request"
}
}
}
},
"securityDefinitions": {
"BasicAuth": {
"type": "basic"
}
},
"externalDocs": {
"description": "OpenAPI",
"url": "https://swagger.io/resources/open-api/"
}
}

177
docs/swagger.yaml Normal file
View File

@ -0,0 +1,177 @@
basePath: /api/v1
definitions:
entity.ProductDisplay:
properties:
created_at:
type: string
description:
type: string
id:
type: integer
name:
type: string
original_price:
type: number
price:
type: number
quantity:
type: integer
status:
type: boolean
updated_at:
type: string
type: object
httputil.HTTPError:
properties:
code:
example: 400
type: integer
message:
example: status bad request
type: string
type: object
externalDocs:
description: OpenAPI
url: https://swagger.io/resources/open-api/
host: localhost:9000
info:
contact:
email: support@swagger.io
name: API Support
url: http://www.swagger.io/support
description: This is a sample server celler server.
license:
name: Apache 2.0
url: http://www.apache.org/licenses/LICENSE-2.0.html
termsOfService: http://swagger.io/terms/
title: Swagger Example API
version: "1.0"
paths:
/products:
get:
consumes:
- application/json
description: get Products
parameters:
- description: name search by q
format: email
in: query
name: q
type: string
produces:
- application/json
responses:
"200":
description: OK
schema:
items:
$ref: '#/definitions/entity.ProductDisplay'
type: array
"400":
description: Bad Request
schema:
$ref: '#/definitions/httputil.HTTPError'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/httputil.HTTPError'
summary: List Products
tags:
- Products
/products/{id}:
delete:
consumes:
- application/json
description: Delete Product by ID
parameters:
- description: product ID
in: path
name: id
required: true
type: integer
produces:
- application/json
responses:
"200":
description: OK
schema:
type: string
"400":
description: Bad Request
schema:
$ref: '#/definitions/httputil.HTTPError'
"404":
description: Not Found
schema:
$ref: '#/definitions/httputil.HTTPError'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/httputil.HTTPError'
summary: Delete an product
tags:
- Products
get:
consumes:
- application/json
description: get string by ID
parameters:
- description: product ID
in: path
name: id
required: true
type: integer
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/entity.ProductDisplay'
"404":
description: Not Found
schema:
$ref: '#/definitions/httputil.HTTPError'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/httputil.HTTPError'
summary: Show an product
tags:
- Products
put:
consumes:
- application/json
description: update Product by ID
parameters:
- description: product ID
in: path
name: id
required: true
type: integer
produces:
- application/json
responses:
"200":
description: OK
schema:
type: string
"400":
description: Bad Request
schema:
$ref: '#/definitions/httputil.HTTPError'
"404":
description: Not Found
schema:
$ref: '#/definitions/httputil.HTTPError'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/httputil.HTTPError'
summary: Update an product
tags:
- Products
securityDefinitions:
BasicAuth:
type: basic
swagger: "2.0"

31
domain/domain.go Normal file
View File

@ -0,0 +1,31 @@
package domain
import (
"github.com/gin-gonic/gin"
"online-order/entity"
)
type DomainRepository interface {
List() ([]*entity.DomainDisplay, error)
Create(p *entity.DomainCreateUpdate) error
GetByID(id int) (*entity.DomainDisplay, error)
GetByDomain(d string) (*entity.DomainDisplay, error)
Update(p *entity.DomainCreateUpdate) error
Delete(id int) error
}
type DomainService interface {
List() ([]*entity.DomainDisplay, error)
Create(u *entity.DomainCreateUpdate) error
GetByID(id int) (*entity.DomainDisplay, error)
GetByDomain(d string) (*entity.DomainDisplay, error)
Update(u *entity.DomainCreateUpdate) error
Delete(id int) error
}
type DomainController interface {
listDomain(ctx *gin.Context)
getDomain(ctx *gin.Context)
updateDomain(ctx *gin.Context)
deleteDomain(ctx *gin.Context)
}

View File

@ -23,7 +23,7 @@ type ProductService interface {
Delete(id int) error
}
type UserController interface {
type ProductController interface {
listProduct(ctx *gin.Context)
getProduct(ctx *gin.Context)
updateProduct(ctx *gin.Context)

View File

@ -28,6 +28,8 @@ type Domain struct {
UserID *int `json:"user_id,omitempty"`
// Config holds the value of the "config" field.
Config []string `json:"config,omitempty"`
// Status holds the value of the "status" field.
Status bool `json:"status,omitempty"`
// CreatedAt holds the value of the "created_at" field.
CreatedAt time.Time `json:"created_at,omitempty"`
// UpdatedAt holds the value of the "updated_at" field.
@ -82,6 +84,8 @@ func (*Domain) scanValues(columns []string) ([]any, error) {
switch columns[i] {
case domain.FieldConfig:
values[i] = new([]byte)
case domain.FieldStatus:
values[i] = new(sql.NullBool)
case domain.FieldID, domain.FieldBusinessID, domain.FieldUserID:
values[i] = new(sql.NullInt64)
case domain.FieldDomain:
@ -137,6 +141,12 @@ func (d *Domain) assignValues(columns []string, values []any) error {
return fmt.Errorf("unmarshal field config: %w", err)
}
}
case domain.FieldStatus:
if value, ok := values[i].(*sql.NullBool); !ok {
return fmt.Errorf("unexpected type %T for field status", values[i])
} else if value.Valid {
d.Status = value.Bool
}
case domain.FieldCreatedAt:
if value, ok := values[i].(*sql.NullTime); !ok {
return fmt.Errorf("unexpected type %T for field created_at", values[i])
@ -211,6 +221,9 @@ func (d *Domain) String() string {
builder.WriteString("config=")
builder.WriteString(fmt.Sprintf("%v", d.Config))
builder.WriteString(", ")
builder.WriteString("status=")
builder.WriteString(fmt.Sprintf("%v", d.Status))
builder.WriteString(", ")
builder.WriteString("created_at=")
builder.WriteString(d.CreatedAt.Format(time.ANSIC))
builder.WriteString(", ")

View File

@ -22,6 +22,8 @@ const (
FieldUserID = "user_id"
// FieldConfig holds the string denoting the config field in the database.
FieldConfig = "config"
// FieldStatus holds the string denoting the status field in the database.
FieldStatus = "status"
// FieldCreatedAt holds the string denoting the created_at field in the database.
FieldCreatedAt = "created_at"
// FieldUpdatedAt holds the string denoting the updated_at field in the database.
@ -55,6 +57,7 @@ var Columns = []string{
FieldBusinessID,
FieldUserID,
FieldConfig,
FieldStatus,
FieldCreatedAt,
FieldUpdatedAt,
}
@ -70,6 +73,8 @@ func ValidColumn(column string) bool {
}
var (
// DefaultStatus holds the default value on creation for the "status" field.
DefaultStatus bool
// DefaultCreatedAt holds the default value on creation for the "created_at" field.
DefaultCreatedAt func() time.Time
// DefaultUpdatedAt holds the default value on creation for the "updated_at" field.
@ -101,6 +106,11 @@ func ByUserID(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldUserID, opts...).ToFunc()
}
// ByStatus orders the results by the status field.
func ByStatus(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldStatus, opts...).ToFunc()
}
// ByCreatedAt orders the results by the created_at field.
func ByCreatedAt(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldCreatedAt, opts...).ToFunc()

View File

@ -70,6 +70,11 @@ func UserID(v int) predicate.Domain {
return predicate.Domain(sql.FieldEQ(FieldUserID, v))
}
// Status applies equality check predicate on the "status" field. It's identical to StatusEQ.
func Status(v bool) predicate.Domain {
return predicate.Domain(sql.FieldEQ(FieldStatus, v))
}
// CreatedAt applies equality check predicate on the "created_at" field. It's identical to CreatedAtEQ.
func CreatedAt(v time.Time) predicate.Domain {
return predicate.Domain(sql.FieldEQ(FieldCreatedAt, v))
@ -215,6 +220,16 @@ func ConfigNotNil() predicate.Domain {
return predicate.Domain(sql.FieldNotNull(FieldConfig))
}
// StatusEQ applies the EQ predicate on the "status" field.
func StatusEQ(v bool) predicate.Domain {
return predicate.Domain(sql.FieldEQ(FieldStatus, v))
}
// StatusNEQ applies the NEQ predicate on the "status" field.
func StatusNEQ(v bool) predicate.Domain {
return predicate.Domain(sql.FieldNEQ(FieldStatus, v))
}
// CreatedAtEQ applies the EQ predicate on the "created_at" field.
func CreatedAtEQ(v time.Time) predicate.Domain {
return predicate.Domain(sql.FieldEQ(FieldCreatedAt, v))

View File

@ -62,6 +62,20 @@ func (dc *DomainCreate) SetConfig(s []string) *DomainCreate {
return dc
}
// SetStatus sets the "status" field.
func (dc *DomainCreate) SetStatus(b bool) *DomainCreate {
dc.mutation.SetStatus(b)
return dc
}
// SetNillableStatus sets the "status" field if the given value is not nil.
func (dc *DomainCreate) SetNillableStatus(b *bool) *DomainCreate {
if b != nil {
dc.SetStatus(*b)
}
return dc
}
// SetCreatedAt sets the "created_at" field.
func (dc *DomainCreate) SetCreatedAt(t time.Time) *DomainCreate {
dc.mutation.SetCreatedAt(t)
@ -163,6 +177,10 @@ func (dc *DomainCreate) ExecX(ctx context.Context) {
// defaults sets the default values of the builder before save.
func (dc *DomainCreate) defaults() {
if _, ok := dc.mutation.Status(); !ok {
v := domain.DefaultStatus
dc.mutation.SetStatus(v)
}
if _, ok := dc.mutation.CreatedAt(); !ok {
v := domain.DefaultCreatedAt()
dc.mutation.SetCreatedAt(v)
@ -178,6 +196,9 @@ func (dc *DomainCreate) check() error {
if _, ok := dc.mutation.Domain(); !ok {
return &ValidationError{Name: "domain", err: errors.New(`ent: missing required field "Domain.domain"`)}
}
if _, ok := dc.mutation.Status(); !ok {
return &ValidationError{Name: "status", err: errors.New(`ent: missing required field "Domain.status"`)}
}
if _, ok := dc.mutation.CreatedAt(); !ok {
return &ValidationError{Name: "created_at", err: errors.New(`ent: missing required field "Domain.created_at"`)}
}
@ -218,6 +239,10 @@ func (dc *DomainCreate) createSpec() (*Domain, *sqlgraph.CreateSpec) {
_spec.SetField(domain.FieldConfig, field.TypeJSON, value)
_node.Config = value
}
if value, ok := dc.mutation.Status(); ok {
_spec.SetField(domain.FieldStatus, field.TypeBool, value)
_node.Status = value
}
if value, ok := dc.mutation.CreatedAt(); ok {
_spec.SetField(domain.FieldCreatedAt, field.TypeTime, value)
_node.CreatedAt = value

View File

@ -95,6 +95,20 @@ func (du *DomainUpdate) ClearConfig() *DomainUpdate {
return du
}
// SetStatus sets the "status" field.
func (du *DomainUpdate) SetStatus(b bool) *DomainUpdate {
du.mutation.SetStatus(b)
return du
}
// SetNillableStatus sets the "status" field if the given value is not nil.
func (du *DomainUpdate) SetNillableStatus(b *bool) *DomainUpdate {
if b != nil {
du.SetStatus(*b)
}
return du
}
// SetCreatedAt sets the "created_at" field.
func (du *DomainUpdate) SetCreatedAt(t time.Time) *DomainUpdate {
du.mutation.SetCreatedAt(t)
@ -229,6 +243,9 @@ func (du *DomainUpdate) sqlSave(ctx context.Context) (n int, err error) {
if du.mutation.ConfigCleared() {
_spec.ClearField(domain.FieldConfig, field.TypeJSON)
}
if value, ok := du.mutation.Status(); ok {
_spec.SetField(domain.FieldStatus, field.TypeBool, value)
}
if value, ok := du.mutation.CreatedAt(); ok {
_spec.SetField(domain.FieldCreatedAt, field.TypeTime, value)
}
@ -377,6 +394,20 @@ func (duo *DomainUpdateOne) ClearConfig() *DomainUpdateOne {
return duo
}
// SetStatus sets the "status" field.
func (duo *DomainUpdateOne) SetStatus(b bool) *DomainUpdateOne {
duo.mutation.SetStatus(b)
return duo
}
// SetNillableStatus sets the "status" field if the given value is not nil.
func (duo *DomainUpdateOne) SetNillableStatus(b *bool) *DomainUpdateOne {
if b != nil {
duo.SetStatus(*b)
}
return duo
}
// SetCreatedAt sets the "created_at" field.
func (duo *DomainUpdateOne) SetCreatedAt(t time.Time) *DomainUpdateOne {
duo.mutation.SetCreatedAt(t)
@ -541,6 +572,9 @@ func (duo *DomainUpdateOne) sqlSave(ctx context.Context) (_node *Domain, err err
if duo.mutation.ConfigCleared() {
_spec.ClearField(domain.FieldConfig, field.TypeJSON)
}
if value, ok := duo.mutation.Status(); ok {
_spec.SetField(domain.FieldStatus, field.TypeBool, value)
}
if value, ok := duo.mutation.CreatedAt(); ok {
_spec.SetField(domain.FieldCreatedAt, field.TypeTime, value)
}

View File

@ -88,6 +88,7 @@ var (
{Name: "id", Type: field.TypeInt, Increment: true},
{Name: "domain", Type: field.TypeString, Unique: true},
{Name: "config", Type: field.TypeJSON, Nullable: true},
{Name: "status", Type: field.TypeBool, Default: true},
{Name: "created_at", Type: field.TypeTime},
{Name: "updated_at", Type: field.TypeTime},
{Name: "business_id", Type: field.TypeInt, Nullable: true},
@ -101,13 +102,13 @@ var (
ForeignKeys: []*schema.ForeignKey{
{
Symbol: "domains_businesses_domains",
Columns: []*schema.Column{DomainsColumns[5]},
Columns: []*schema.Column{DomainsColumns[6]},
RefColumns: []*schema.Column{BusinessesColumns[0]},
OnDelete: schema.SetNull,
},
{
Symbol: "domains_users_domains",
Columns: []*schema.Column{DomainsColumns[6]},
Columns: []*schema.Column{DomainsColumns[7]},
RefColumns: []*schema.Column{UsersColumns[0]},
OnDelete: schema.SetNull,
},

View File

@ -2472,6 +2472,7 @@ type DomainMutation struct {
domain *string
_config *[]string
append_config []string
status *bool
created_at *time.Time
updated_at *time.Time
clearedFields map[string]struct{}
@ -2781,6 +2782,42 @@ func (m *DomainMutation) ResetConfig() {
delete(m.clearedFields, domain.FieldConfig)
}
// SetStatus sets the "status" field.
func (m *DomainMutation) SetStatus(b bool) {
m.status = &b
}
// Status returns the value of the "status" field in the mutation.
func (m *DomainMutation) Status() (r bool, exists bool) {
v := m.status
if v == nil {
return
}
return *v, true
}
// OldStatus returns the old "status" field's value of the Domain entity.
// If the Domain object wasn't provided to the builder, the object is fetched from the database.
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
func (m *DomainMutation) OldStatus(ctx context.Context) (v bool, err error) {
if !m.op.Is(OpUpdateOne) {
return v, errors.New("OldStatus is only allowed on UpdateOne operations")
}
if m.id == nil || m.oldValue == nil {
return v, errors.New("OldStatus requires an ID field in the mutation")
}
oldValue, err := m.oldValue(ctx)
if err != nil {
return v, fmt.Errorf("querying old value for OldStatus: %w", err)
}
return oldValue.Status, nil
}
// ResetStatus resets all changes to the "status" field.
func (m *DomainMutation) ResetStatus() {
m.status = nil
}
// SetCreatedAt sets the "created_at" field.
func (m *DomainMutation) SetCreatedAt(t time.Time) {
m.created_at = &t
@ -2967,7 +3004,7 @@ func (m *DomainMutation) Type() string {
// order to get all numeric fields that were incremented/decremented, call
// AddedFields().
func (m *DomainMutation) Fields() []string {
fields := make([]string, 0, 6)
fields := make([]string, 0, 7)
if m.domain != nil {
fields = append(fields, domain.FieldDomain)
}
@ -2980,6 +3017,9 @@ func (m *DomainMutation) Fields() []string {
if m._config != nil {
fields = append(fields, domain.FieldConfig)
}
if m.status != nil {
fields = append(fields, domain.FieldStatus)
}
if m.created_at != nil {
fields = append(fields, domain.FieldCreatedAt)
}
@ -3002,6 +3042,8 @@ func (m *DomainMutation) Field(name string) (ent.Value, bool) {
return m.UserID()
case domain.FieldConfig:
return m.Config()
case domain.FieldStatus:
return m.Status()
case domain.FieldCreatedAt:
return m.CreatedAt()
case domain.FieldUpdatedAt:
@ -3023,6 +3065,8 @@ func (m *DomainMutation) OldField(ctx context.Context, name string) (ent.Value,
return m.OldUserID(ctx)
case domain.FieldConfig:
return m.OldConfig(ctx)
case domain.FieldStatus:
return m.OldStatus(ctx)
case domain.FieldCreatedAt:
return m.OldCreatedAt(ctx)
case domain.FieldUpdatedAt:
@ -3064,6 +3108,13 @@ func (m *DomainMutation) SetField(name string, value ent.Value) error {
}
m.SetConfig(v)
return nil
case domain.FieldStatus:
v, ok := value.(bool)
if !ok {
return fmt.Errorf("unexpected type %T for field %s", value, name)
}
m.SetStatus(v)
return nil
case domain.FieldCreatedAt:
v, ok := value.(time.Time)
if !ok {
@ -3163,6 +3214,9 @@ func (m *DomainMutation) ResetField(name string) error {
case domain.FieldConfig:
m.ResetConfig()
return nil
case domain.FieldStatus:
m.ResetStatus()
return nil
case domain.FieldCreatedAt:
m.ResetCreatedAt()
return nil

View File

@ -52,12 +52,16 @@ func init() {
businessconfig.DefaultCompany = businessconfigDescCompany.Default.(string)
domainFields := schema.Domain{}.Fields()
_ = domainFields
// domainDescStatus is the schema descriptor for status field.
domainDescStatus := domainFields[4].Descriptor()
// domain.DefaultStatus holds the default value on creation for the status field.
domain.DefaultStatus = domainDescStatus.Default.(bool)
// domainDescCreatedAt is the schema descriptor for created_at field.
domainDescCreatedAt := domainFields[4].Descriptor()
domainDescCreatedAt := domainFields[5].Descriptor()
// domain.DefaultCreatedAt holds the default value on creation for the created_at field.
domain.DefaultCreatedAt = domainDescCreatedAt.Default.(func() time.Time)
// domainDescUpdatedAt is the schema descriptor for updated_at field.
domainDescUpdatedAt := domainFields[5].Descriptor()
domainDescUpdatedAt := domainFields[6].Descriptor()
// domain.DefaultUpdatedAt holds the default value on creation for the updated_at field.
domain.DefaultUpdatedAt = domainDescUpdatedAt.Default.(func() time.Time)
// domain.UpdateDefaultUpdatedAt holds the default value on update for the updated_at field.

View File

@ -19,6 +19,7 @@ func (Domain) Fields() []ent.Field {
field.Int("business_id").Unique().Optional().Nillable(),
field.Int("user_id").Optional().Nillable(),
field.JSON("config", []string{}).Optional(),
field.Bool("status").Default(true),
field.Time("created_at").Default(time.Now),
field.Time("updated_at").Default(time.Now).UpdateDefault(time.Now),
}

50
entity/domain.go Normal file
View File

@ -0,0 +1,50 @@
package entity
import (
"time"
)
// use to display a domain
type DomainDisplay struct {
ID int `json:"id"`
Domain string `json:"domain"`
BusinessID int `json:"business_id"`
UserID int `json:"user_id"`
Status bool `json:"status"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
// use to create or update a domain
type DomainCreateUpdate struct {
DomainDisplay
Config []string `json:"config"`
}
// Func that will check non empty field on ProductDisplay and update domain
func DomainValidateUpdate(domain *DomainCreateUpdate, d *DomainDisplay) *DomainCreateUpdate {
domain.ID = d.ID
domain.Domain = d.Domain
domain.BusinessID = d.BusinessID
domain.UserID = d.UserID
domain.Status = d.Status
domain.CreatedAt = d.CreatedAt
domain.UpdatedAt = d.UpdatedAt
return domain
}
func DomainDisplayFormatter(domain *DomainCreateUpdate) (p *DomainDisplay) {
p = &DomainDisplay{
ID: domain.ID,
Domain: domain.Domain,
BusinessID: domain.BusinessID,
UserID: domain.UserID,
Status: domain.Status,
CreatedAt: domain.CreatedAt,
UpdatedAt: domain.UpdatedAt,
}
return
}

View File

@ -1,29 +0,0 @@
package entity
import (
"testing"
"github.com/stretchr/testify/assert"
)
func Test_ValidateUpdate_With_Same_Name(t *testing.T) {
p := &ProductDisplay{
ID: 2312,
Name: "Pizza Name",
Description: "new Pizza",
Price: 15000,
}
product_to_update := &ProductCreateUpdate{
ProductDisplay: ProductDisplay{
ID: 2312,
Name: "new Pizza Name",
Description: "new Pizza",
Price: 15000,
},
}
result := ValidateUpdate(product_to_update, p)
assert.NotEqual(t, result.Name, "Pizza Name")
assert.Equal(t, result.Name, p.Name)
}

38
go.mod
View File

@ -10,34 +10,44 @@ require (
github.com/rs/zerolog v1.31.0
github.com/spf13/viper v1.17.0
github.com/stretchr/testify v1.8.4
golang.org/x/crypto v0.13.0
golang.org/x/crypto v0.14.0
)
require (
ariga.io/atlas v0.14.1-0.20230918065911-83ad451a4935 // indirect
github.com/KyleBanks/depth v1.2.1 // indirect
github.com/PuerkitoBio/purell v1.2.1 // indirect
github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 // indirect
github.com/agext/levenshtein v1.2.1 // indirect
github.com/apparentlymart/go-textseg/v13 v13.0.0 // indirect
github.com/bytedance/sonic v1.9.1 // indirect
github.com/chenzhuoyu/base64x v0.0.0-20221115062448-fe3a3abad311 // indirect
github.com/bytedance/sonic v1.10.2 // indirect
github.com/chenzhuoyu/base64x v0.0.0-20230717121745-296ad89f973d // indirect
github.com/chenzhuoyu/iasm v0.9.0 // indirect
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
github.com/fsnotify/fsnotify v1.6.0 // indirect
github.com/gabriel-vasile/mimetype v1.4.2 // indirect
github.com/gabriel-vasile/mimetype v1.4.3 // indirect
github.com/gin-contrib/sse v0.1.0 // indirect
github.com/go-openapi/inflect v0.19.0 // indirect
github.com/go-openapi/jsonpointer v0.20.0 // indirect
github.com/go-openapi/jsonreference v0.20.2 // indirect
github.com/go-openapi/spec v0.20.9 // indirect
github.com/go-openapi/swag v0.22.4 // indirect
github.com/go-playground/locales v0.14.1 // indirect
github.com/go-playground/universal-translator v0.18.1 // indirect
github.com/go-playground/validator/v10 v10.14.0 // indirect
github.com/go-playground/validator/v10 v10.15.5 // indirect
github.com/goccy/go-json v0.10.2 // indirect
github.com/google/go-cmp v0.5.9 // indirect
github.com/google/uuid v1.3.0 // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
github.com/hashicorp/hcl/v2 v2.13.0 // indirect
github.com/josharian/intern v1.0.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/klauspost/cpuid/v2 v2.2.4 // indirect
github.com/klauspost/cpuid/v2 v2.2.5 // indirect
github.com/leodido/go-urn v1.2.4 // indirect
github.com/magiconair/properties v1.8.7 // indirect
github.com/mailru/easyjson v0.7.7 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.19 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/mitchellh/go-wordwrap v0.0.0-20150314170334-ad45545899c7 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
@ -51,18 +61,24 @@ require (
github.com/spf13/cast v1.5.1 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/subosito/gotenv v1.6.0 // indirect
github.com/swaggo/files v1.0.1 // indirect
github.com/swaggo/gin-swagger v1.6.0 // indirect
github.com/swaggo/swag v1.16.2 // indirect
github.com/swaggo/swag/example/celler v0.0.0-20231012023037-2b5852a16877 // indirect
github.com/twitchyliquid64/golang-asm v0.15.1 // indirect
github.com/ugorji/go/codec v1.2.11 // indirect
github.com/zclconf/go-cty v1.8.0 // indirect
go.uber.org/atomic v1.9.0 // indirect
go.uber.org/multierr v1.9.0 // indirect
golang.org/x/arch v0.3.0 // indirect
golang.org/x/arch v0.5.0 // indirect
golang.org/x/exp v0.0.0-20230905200255-921286631fa9 // indirect
golang.org/x/mod v0.12.0 // indirect
golang.org/x/net v0.15.0 // indirect
golang.org/x/sys v0.12.0 // indirect
golang.org/x/mod v0.13.0 // indirect
golang.org/x/net v0.17.0 // indirect
golang.org/x/sys v0.13.0 // indirect
golang.org/x/text v0.13.0 // indirect
golang.org/x/tools v0.14.0 // indirect
google.golang.org/protobuf v1.31.0 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)

98
go.sum
View File

@ -43,17 +43,31 @@ entgo.io/ent v0.12.4/go.mod h1:Y3JVAjtlIk8xVZYSn3t3mf8xlZIn5SAOXZQxD6kKI+Q=
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
github.com/DATA-DOG/go-sqlmock v1.5.0 h1:Shsta01QNfFxHCfpW6YH2STWB0MudeXXEWMr20OEh60=
github.com/KyleBanks/depth v1.2.1 h1:5h8fQADFrWtarTdtDudMmGsC7GPbOAu6RVB3ffsVFHc=
github.com/KyleBanks/depth v1.2.1/go.mod h1:jzSb9d0L43HxTQfT+oSA1EEp2q+ne2uh6XgeJcm8brE=
github.com/PuerkitoBio/purell v1.2.1 h1:QsZ4TjvwiMpat6gBCBxEQI0rcS9ehtkKtSpiUnd9N28=
github.com/PuerkitoBio/purell v1.2.1/go.mod h1:ZwHcC/82TOaovDi//J/804umJFFmbOHPngi8iYYv/Eo=
github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 h1:d+Bc7a5rLufV/sSk/8dngufqelfh6jnri85riMAaF/M=
github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578/go.mod h1:uGdkoq3SwY9Y+13GIhn11/XLaGBb4BfwItxLd5jeuXE=
github.com/agext/levenshtein v1.2.1 h1:QmvMAjj2aEICytGiWzmxoE0x2KZvE0fvmqMOfy2tjT8=
github.com/agext/levenshtein v1.2.1/go.mod h1:JEDfjyjHDjOF/1e4FlBE/PkbqA9OfWu2ki2W0IB5558=
github.com/apparentlymart/go-dump v0.0.0-20180507223929-23540a00eaa3/go.mod h1:oL81AME2rN47vu18xqj1S1jPIPuN7afo62yKTNn3XMM=
github.com/apparentlymart/go-textseg/v13 v13.0.0 h1:Y+KvPE1NYz0xl601PVImeQfFyEy6iT90AvPUL1NNfNw=
github.com/apparentlymart/go-textseg/v13 v13.0.0/go.mod h1:ZK2fH7c4NqDTLtiYLvIkEghdlcqw7yxLeM89kiTRPUo=
github.com/bytedance/sonic v1.5.0/go.mod h1:ED5hyg4y6t3/9Ku1R6dU/4KyJ48DZ4jPhfY1O2AihPM=
github.com/bytedance/sonic v1.9.1 h1:6iJ6NqdoxCDr6mbY8h18oSO+cShGSMRGCEo7F2h0x8s=
github.com/bytedance/sonic v1.9.1/go.mod h1:i736AoUSYt75HyZLoJW9ERYxcy6eaN6h4BZXU064P/U=
github.com/bytedance/sonic v1.10.0-rc/go.mod h1:ElCzW+ufi8qKqNW0FY314xriJhyJhuoJ3gFZdAHF7NM=
github.com/bytedance/sonic v1.10.2 h1:GQebETVBxYB7JGWJtLBi07OVzWwt+8dWA00gEVW2ZFE=
github.com/bytedance/sonic v1.10.2/go.mod h1:iZcSUejdk5aukTND/Eu/ivjQuEL0Cu9/rf50Hi0u/g4=
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
github.com/chenzhuoyu/base64x v0.0.0-20211019084208-fb5309c8db06/go.mod h1:DH46F32mSOjUmXrMHnKwZdA8wcEefY7UVqBKYGjpdQY=
github.com/chenzhuoyu/base64x v0.0.0-20221115062448-fe3a3abad311 h1:qSGYFH7+jGhDF8vLC+iwCD4WpbV1EBDSzWkJODFLams=
github.com/chenzhuoyu/base64x v0.0.0-20221115062448-fe3a3abad311/go.mod h1:b583jCggY9gE99b6G5LEC39OIiVsWj+R97kbl5odCEk=
github.com/chenzhuoyu/base64x v0.0.0-20230717121745-296ad89f973d h1:77cEq6EriyTZ0g/qfRdp61a3Uu/AWrgIq2s0ClJV1g0=
github.com/chenzhuoyu/base64x v0.0.0-20230717121745-296ad89f973d/go.mod h1:8EPpVsBuRksnlj1mLy4AWzRNQYxauNi62uWcE3to6eA=
github.com/chenzhuoyu/iasm v0.9.0 h1:9fhXjVzq5hUy2gkhhgHl95zG2cEAhw9OSGs8toWWAwo=
github.com/chenzhuoyu/iasm v0.9.0/go.mod h1:Xjy2NpN3h7aUqeqM+woSuuvxmIe6+DDsiNLIrkAmYog=
github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI=
github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI=
github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU=
@ -62,6 +76,8 @@ github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGX
github.com/cncf/udpa/go v0.0.0-20200629203442-efcf912fb354/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk=
github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk=
github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc=
github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU=
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM=
@ -77,6 +93,8 @@ github.com/fsnotify/fsnotify v1.6.0 h1:n+5WquG0fcWoWp6xPWfHdbskMCQaFnG6PfBrh1Ky4
github.com/fsnotify/fsnotify v1.6.0/go.mod h1:sl3t1tCWJFWoRz9R8WJCbQihKKwmorjAbSClcnxKAGw=
github.com/gabriel-vasile/mimetype v1.4.2 h1:w5qFW6JKBz9Y393Y4q372O9A7cUSequkh1Q7OhCmWKU=
github.com/gabriel-vasile/mimetype v1.4.2/go.mod h1:zApsH/mKG4w07erKIaJPFiX0Tsq9BFQgN3qGY5GnNgA=
github.com/gabriel-vasile/mimetype v1.4.3 h1:in2uUcidCuFcDKtdcBxlR0rJ1+fsokWf+uqxgUFjbI0=
github.com/gabriel-vasile/mimetype v1.4.3/go.mod h1:d8uq/6HKRL6CGdk+aubisF/M5GcPfT7nKyLpA0lbSSk=
github.com/gin-contrib/sse v0.1.0 h1:Y/yl/+YNO8GZSjAhjMsSuLt29uWRFHdHYUb5lYOV9qE=
github.com/gin-contrib/sse v0.1.0/go.mod h1:RHrZQHXnP2xjPF+u1gW/2HnVO7nvIa9PG3Gm+fLHvGI=
github.com/gin-gonic/gin v1.9.1 h1:4idEAncQnU5cB7BeOkPtxjfCSye0AAm1R0RVIqJ+Jmg=
@ -86,6 +104,21 @@ github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
github.com/go-openapi/inflect v0.19.0 h1:9jCH9scKIbHeV9m12SmPilScz6krDxKRasNNSNPXu/4=
github.com/go-openapi/inflect v0.19.0/go.mod h1:lHpZVlpIQqLyKwJ4N+YSc9hchQy/i12fJykb83CRBH4=
github.com/go-openapi/jsonpointer v0.19.3/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg=
github.com/go-openapi/jsonpointer v0.19.5/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg=
github.com/go-openapi/jsonpointer v0.19.6/go.mod h1:osyAmYz/mB/C3I+WsTTSgw1ONzaLJoLCyoi6/zppojs=
github.com/go-openapi/jsonpointer v0.20.0 h1:ESKJdU9ASRfaPNOPRx12IUyA1vn3R9GiE3KYD14BXdQ=
github.com/go-openapi/jsonpointer v0.20.0/go.mod h1:6PGzBjjIIumbLYysB73Klnms1mwnU4G3YHOECG3CedA=
github.com/go-openapi/jsonreference v0.20.0/go.mod h1:Ag74Ico3lPc+zR+qjn4XBUmXymS4zJbYVCZmcgkasdo=
github.com/go-openapi/jsonreference v0.20.2 h1:3sVjiK66+uXK/6oQ8xgcRKcFgQ5KXa2KvnJRumpMGbE=
github.com/go-openapi/jsonreference v0.20.2/go.mod h1:Bl1zwGIM8/wsvqjsOQLJ/SH+En5Ap4rVB5KVcIDZG2k=
github.com/go-openapi/spec v0.20.9 h1:xnlYNQAwKd2VQRRfwTEI0DcK+2cbuvI/0c7jx3gA8/8=
github.com/go-openapi/spec v0.20.9/go.mod h1:2OpW+JddWPrpXSCIX8eOx7lZ5iyuWj3RYR6VaaBKcWA=
github.com/go-openapi/swag v0.19.5/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk=
github.com/go-openapi/swag v0.19.15/go.mod h1:QYRuS/SOXUCsnplDa677K7+DxSOj6IPNl/eQntq43wQ=
github.com/go-openapi/swag v0.22.3/go.mod h1:UzaqsxGiab7freDnrUUra0MwWfN/q7tE4j+VcZ0yl14=
github.com/go-openapi/swag v0.22.4 h1:QLMzNJnMGPRNDCbySlcj1x01tzU8/9LTTL9hZZZogBU=
github.com/go-openapi/swag v0.22.4/go.mod h1:UzaqsxGiab7freDnrUUra0MwWfN/q7tE4j+VcZ0yl14=
github.com/go-playground/assert/v2 v2.2.0 h1:JvknZsQTYeFEAhQwI4qEt9cyV5ONwRHC+lYKSsYSR8s=
github.com/go-playground/locales v0.14.1 h1:EWaQ/wswjilfKLTECiXz7Rh+3BjFhfDFKv/oXslEjJA=
github.com/go-playground/locales v0.14.1/go.mod h1:hxrqLVvrK65+Rwrd5Fc6F2O76J/NuW9t0sjnWqG1slY=
@ -93,9 +126,12 @@ github.com/go-playground/universal-translator v0.18.1 h1:Bcnm0ZwsGyWbCzImXv+pAJn
github.com/go-playground/universal-translator v0.18.1/go.mod h1:xekY+UJKNuX9WP91TpwSH2VMlDf28Uj24BCp08ZFTUY=
github.com/go-playground/validator/v10 v10.14.0 h1:vgvQWe3XCz3gIeFDm/HnTIbj6UGmg/+t63MyGU2n5js=
github.com/go-playground/validator/v10 v10.14.0/go.mod h1:9iXMNT7sEkjXb0I+enO7QXmzG6QCsPWY4zveKFVRSyU=
github.com/go-playground/validator/v10 v10.15.5 h1:LEBecTWb/1j5TNY1YYG2RcOUN3R7NLylN+x8TTueE24=
github.com/go-playground/validator/v10 v10.15.5/go.mod h1:9iXMNT7sEkjXb0I+enO7QXmzG6QCsPWY4zveKFVRSyU=
github.com/go-sql-driver/mysql v1.7.1 h1:lUIinVbN1DY0xBg0eMOzmmtGoHwWBbvnWubQUrtU8EI=
github.com/go-sql-driver/mysql v1.7.1/go.mod h1:OXbVy3sEdcQ2Doequ6Z5BW6fXNQTmx+9S1MCJN5yJMI=
github.com/go-test/deep v1.0.3 h1:ZrJSEWsXzPOxaZnFteGEfooLba+ju3FYIbOrS+rQd68=
github.com/go-test/deep v1.0.3/go.mod h1:wGDj63lr65AM2AQyKZd/NYHGb0R+1RLqB8NKt3aSFNA=
github.com/goccy/go-json v0.10.2 h1:CrxCmQqYDkv1z7lO7Wbh2HN93uovUHgrECaO5ZrCXAU=
github.com/goccy/go-json v0.10.2/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I=
github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA=
@ -172,6 +208,8 @@ github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:
github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8=
github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw=
github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY=
github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y=
github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM=
github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo=
github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU=
@ -180,22 +218,35 @@ github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+o
github.com/klauspost/cpuid/v2 v2.0.9/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg=
github.com/klauspost/cpuid/v2 v2.2.4 h1:acbojRNwl3o09bUq+yDCtZFc1aiwaAAxtcn8YkZXnvk=
github.com/klauspost/cpuid/v2 v2.2.4/go.mod h1:RVVoqg1df56z8g3pUjL/3lE5UfnlrJX8tyFgg4nqhuY=
github.com/klauspost/cpuid/v2 v2.2.5 h1:0E5MSMDEoAulmXNFquVs//DdoomxaoTY1kUhbc/qbZg=
github.com/klauspost/cpuid/v2 v2.2.5/go.mod h1:Lcz8mBdAVJIBVzewtcLocK12l3Y+JytZYpaMropDUws=
github.com/knz/go-libedit v1.10.1/go.mod h1:MZTVkCWyz0oBc7JOWP3wNAzd002ZbM/5hgShxwh4x8M=
github.com/kr/fs v0.1.0/go.mod h1:FFnZGqtBN9Gxj7eW1uZ42v5BccTP0vu6NEaFoC2HwRg=
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
github.com/kylelemons/godebug v0.0.0-20170820004349-d65d576e9348 h1:MtvEpTB6LX3vkb4ax0b5D2DHbNAUsen0Gx5wZoq3lV4=
github.com/kylelemons/godebug v0.0.0-20170820004349-d65d576e9348/go.mod h1:B69LEHPfb2qLo0BaaOLcbitczOKLWTsrBG9LczfCD4k=
github.com/leodido/go-urn v1.2.4 h1:XlAE/cm/ms7TE/VMVoduSpNBoyc2dOxHs5MZSwAN63Q=
github.com/leodido/go-urn v1.2.4/go.mod h1:7ZrI8mTSeBSHl/UaRyKQW1qZeMgak41ANeCNaVckg+4=
github.com/magiconair/properties v1.8.7 h1:IeQXZAiQcpL9mgcAe1Nu6cX9LLw6ExEHKjN0VQdvPDY=
github.com/magiconair/properties v1.8.7/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3vdS329zhj2hYo0=
github.com/mailru/easyjson v0.0.0-20190614124828-94de47d64c63/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc=
github.com/mailru/easyjson v0.0.0-20190626092158-b2ccc519800e/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc=
github.com/mailru/easyjson v0.7.6/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc=
github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0=
github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc=
github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA=
github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg=
github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
github.com/mattn/go-isatty v0.0.19 h1:JITubQf0MOLdlGRuRq+jtsDlekdYPia9ZFsB8h/APPA=
github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=
github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
github.com/mattn/go-runewidth v0.0.9 h1:Lm995f3rfxdpd6TSmuVCHVb/QhupuXlYr8sCI/QdE+0=
github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI=
github.com/mattn/go-sqlite3 v1.14.16 h1:yOQRA0RpS5PFz/oikGwBEqvAWhWg5ufRz4ETLjwpU1Y=
@ -208,6 +259,7 @@ github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M=
github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk=
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno=
github.com/olekukonko/tablewriter v0.0.5 h1:P2Ga83D34wi1o9J6Wh1mRuqd4mF/x/lgBS7N7AbDhec=
github.com/olekukonko/tablewriter v0.0.5/go.mod h1:hPp6KlRPjbx+hW8ykQs1w3UBbZlj6HuIJcUGPhkA7kY=
github.com/pelletier/go-toml/v2 v2.1.0 h1:FnwAJ4oYMvbT/34k9zzHuZNrhlz48GB3/s6at6/MHO4=
@ -223,11 +275,14 @@ github.com/rogpeppe/go-internal v1.9.0 h1:73kH8U+JUqXU8lRuOHeVHaa/SZPifC7BkcraZV
github.com/rs/xid v1.5.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg=
github.com/rs/zerolog v1.31.0 h1:FcTR3NnLWW+NnTwwhFWiJSZr4ECLpqCm6QsEnyvbV4A=
github.com/rs/zerolog v1.31.0/go.mod h1:/7mN4D5sKwJLZQ2b/znpjC3/GQWY/xaDXUM0kKWRHss=
github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
github.com/sagikazarmark/locafero v0.3.0 h1:zT7VEGWC2DTflmccN/5T1etyKvxSxpHsjb9cJvm4SvQ=
github.com/sagikazarmark/locafero v0.3.0/go.mod h1:w+v7UsPNFwzF1cHuOajOOzoq4U7v/ig1mpRjqV+Bu1U=
github.com/sagikazarmark/slog-shim v0.1.0 h1:diDBnUNK9N/354PgrxMywXnAwEr1QZcOr6gto+ugjYE=
github.com/sagikazarmark/slog-shim v0.1.0/go.mod h1:SrcSrq8aKtyuqEI1uvTDTK1arOWRIczQRv+GVI1AkeQ=
github.com/sergi/go-diff v1.0.0 h1:Kpca3qRNrduNnOQeazBd0ysaKrUJiIuISHxogkT9RPQ=
github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo=
github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc=
github.com/sourcegraph/conc v0.3.0 h1:OQTbbt6P72L20UqAkXXuLOj79LfEanQ+YQFNpLA9ySo=
github.com/sourcegraph/conc v0.3.0/go.mod h1:Sdozi7LEKbFPqYX2/J+iBAM6HpqSLTASQIKqDmF7Mt0=
github.com/spf13/afero v1.10.0 h1:EaGW2JJh15aKOejeuJ+wpFSHnbd7GE6Wvp3TsNhb6LY=
@ -246,6 +301,7 @@ github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpE
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA=
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
@ -255,18 +311,29 @@ github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcU
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
github.com/subosito/gotenv v1.6.0 h1:9NlTDc1FTs4qu0DDq7AEtTPNw6SVm7uBMsUCUjABIf8=
github.com/subosito/gotenv v1.6.0/go.mod h1:Dk4QP5c2W3ibzajGcXpNraDfq2IrhjMIvMSWPKKo0FU=
github.com/swaggo/files v1.0.1 h1:J1bVJ4XHZNq0I46UU90611i9/YzdrF7x92oX1ig5IdE=
github.com/swaggo/files v1.0.1/go.mod h1:0qXmMNH6sXNf+73t65aKeB+ApmgxdnkQzVTAj2uaMUg=
github.com/swaggo/gin-swagger v1.6.0 h1:y8sxvQ3E20/RCyrXeFfg60r6H0Z+SwpTjMYsMm+zy8M=
github.com/swaggo/gin-swagger v1.6.0/go.mod h1:BG00cCEy294xtVpyIAHG6+e2Qzj/xKlRdOqDkvq0uzo=
github.com/swaggo/swag v1.16.2 h1:28Pp+8DkQoV+HLzLx8RGJZXNGKbFqnuvSbAAtoxiY04=
github.com/swaggo/swag v1.16.2/go.mod h1:6YzXnDcpr0767iOejs318CwYkCQqyGer6BizOg03f+E=
github.com/swaggo/swag/example/celler v0.0.0-20231012023037-2b5852a16877 h1:GLD+cKjytGsoUokQnFxV88eBtbIyKmoTNP6O40KvjHk=
github.com/swaggo/swag/example/celler v0.0.0-20231012023037-2b5852a16877/go.mod h1:AKDmkSEqXqsZMqOXNXs53EZsD9D/SlZYxxNq2JZkoAw=
github.com/twitchyliquid64/golang-asm v0.15.1 h1:SU5vSMR7hnwNxj24w34ZyCi/FmDZTkS4MhqMhdFk5YI=
github.com/twitchyliquid64/golang-asm v0.15.1/go.mod h1:a1lVb/DtPvCB8fslRZhAngC2+aY1QWCk3Cedj/Gdt08=
github.com/ugorji/go/codec v1.2.11 h1:BMaWp1Bb6fHwEtbplGBGJ498wD+LKlNSl25MjdZY4dU=
github.com/ugorji/go/codec v1.2.11/go.mod h1:UNopzCgEMSXjBc6AOMqYvWC1ktqTAfzJZUZgYf6w6lg=
github.com/urfave/cli/v2 v2.3.0/go.mod h1:LJmUH05zAU44vOAcrfzZQKsZbVcdbOG8rtL3/XcUArI=
github.com/vmihailenco/msgpack/v4 v4.3.12/go.mod h1:gborTTJjAo/GWTqqRjrLCn9pgNN+NXzzngzBKDPIqw4=
github.com/vmihailenco/tagparser v0.1.1/go.mod h1:OeAg3pn3UbLjkWt+rN9oFYB6u/cQgqMEUPoW2WPyhdI=
github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
github.com/zclconf/go-cty v1.8.0 h1:s4AvqaeQzJIu3ndv4gVIhplVD0krU+bgrcLSVUnaWuA=
github.com/zclconf/go-cty v1.8.0/go.mod h1:vVKLxnk3puL4qRAv72AO+W99LUD4da90g3uUAzyuvAk=
github.com/zclconf/go-cty-debug v0.0.0-20191215020915-b22d67c1ba0b/go.mod h1:ZRKQfBXbGkpdV6QMzT3rU1kSTAnfu1dO8dPKjYprgj8=
go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU=
go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8=
go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw=
@ -280,15 +347,20 @@ go.uber.org/multierr v1.9.0/go.mod h1:X2jQV1h+kxSjClGpnseKVIxpmcjrj7MNnI0bnlfKTV
golang.org/x/arch v0.0.0-20210923205945-b76863e36670/go.mod h1:5om86z9Hs0C8fWVUuoMHwpExlXzs5Tkyp9hOrfG7pp8=
golang.org/x/arch v0.3.0 h1:02VY4/ZcO/gBOH6PUaoiptASxtXU10jazRCP865E97k=
golang.org/x/arch v0.3.0/go.mod h1:5om86z9Hs0C8fWVUuoMHwpExlXzs5Tkyp9hOrfG7pp8=
golang.org/x/arch v0.5.0 h1:jpGode6huXQxcskEIpOCvrU+tzo81b6+oFLUYXWtH/Y=
golang.org/x/arch v0.5.0/go.mod h1:5om86z9Hs0C8fWVUuoMHwpExlXzs5Tkyp9hOrfG7pp8=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4=
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/crypto v0.0.0-20220722155217-630584e8d5aa/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
golang.org/x/crypto v0.13.0 h1:mvySKfSWJ+UKUii46M40LOvyWfN0s2U+46/jDd0e6Ck=
golang.org/x/crypto v0.13.0/go.mod h1:y6Z2r+Rw4iayiXXAIxJIDAJ1zMW4yaTpebo8fPOliYc=
golang.org/x/crypto v0.14.0 h1:wBqGXzWJW6m1XrIKlAH0Hs1JJ7+9KBwnIO8v66Q9cHc=
golang.org/x/crypto v0.14.0/go.mod h1:MVFd36DqK4CsrnJYDkBA3VC4m2GkXAM0PvzMCn4JQf4=
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8=
@ -324,8 +396,11 @@ golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.4.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.4.1/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
golang.org/x/mod v0.12.0 h1:rmsUpXtvNzj340zd98LZ4KntptpfRHwpFOHG188oHXc=
golang.org/x/mod v0.12.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
golang.org/x/mod v0.13.0 h1:I/DsJXRlw/8l/0c24sM9yb0T4z9liZTduXvdAWYiysY=
golang.org/x/mod v0.13.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
@ -358,8 +433,12 @@ golang.org/x/net v0.0.0-20201209123823-ac852fbbde11/go.mod h1:m0MpNAwzfU5UDzcl9v
golang.org/x/net v0.0.0-20201224014010-6772e930b67b/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
golang.org/x/net v0.15.0 h1:ugBLEUaxABaB5AJqW9enI0ACdci2RUd4eP51NTBvuJ8=
golang.org/x/net v0.15.0/go.mod h1:idbUs1IY1+zTqbi8yxTbhexhEEk5ur9LInksu6HrEpk=
golang.org/x/net v0.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM=
golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE=
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
@ -379,6 +458,7 @@ golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a/go.mod h1:RxMgew5VJxzue5/jJ
golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
@ -414,13 +494,20 @@ golang.org/x/sys v0.0.0-20210225134936-a50acf3fe073/go.mod h1:h1NjWce9XRLGQEsW7w
golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220704084225-05e143d24a9e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.12.0 h1:CM0HF96J0hcLAwsHPJZjfdNzs0gftsLfgKt57wWHJ0o=
golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE=
golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k=
golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
@ -430,6 +517,7 @@ golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k=
golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
@ -482,8 +570,11 @@ golang.org/x/tools v0.0.0-20201208233053-a543418bbed2/go.mod h1:emZCQorbCU4vsT4f
golang.org/x/tools v0.0.0-20210105154028-b0ab187a4818/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
golang.org/x/tools v0.0.0-20210108195828-e2f9c7f1fc8e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0=
golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
golang.org/x/tools v0.13.0 h1:Iey4qkscZuv0VvIt8E0neZjtPVQFSc870HQ448QgEmQ=
golang.org/x/tools v0.13.0/go.mod h1:HvlwmtVNQAhOuCjW7xxvovg8wbNq7LwfXh/k7wXUl58=
golang.org/x/tools v0.14.0 h1:jvNa2pY0M4r62jkRQ6RwEZZyPcymeL9XZMLBbV7U2nc=
golang.org/x/tools v0.14.0/go.mod h1:uYBEerGOWcJyEORxN+Ek8+TT266gXkNlHdJBwexUsBg=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
@ -582,11 +673,17 @@ google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqw
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo=
gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI=
gopkg.in/ini.v1 v1.67.0 h1:Dgnx+6+nfE+IfzjUEISNeydPJh9AXNNsWbGP9KzCsOA=
gopkg.in/ini.v1 v1.67.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k=
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.0-20200615113413-eeeca48fe776/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
@ -596,6 +693,7 @@ honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWh
honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg=
honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k=
honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k=
nullprogram.com/x/optparse v1.0.0/go.mod h1:KdyPE+Igbe0jQUrVfMqDMeJQIJZEuyV7pjYmp6pbG50=
rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8=
rsc.io/pdf v0.1.1/go.mod h1:n8OzWcQ6Sp37PL01nO98y4iUCRdTGarVfzxY20ICaU4=
rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0=

41
main.go
View File

@ -2,14 +2,16 @@ package main
import (
"context"
"log"
handler_products "online-order/api/handlers/products"
"github.com/gin-gonic/gin"
_ "github.com/go-sql-driver/mysql"
logger "github.com/rs/zerolog/log"
swaggerfiles "github.com/swaggo/files"
ginSwagger "github.com/swaggo/gin-swagger"
"log"
handler_products "online-order/api/handlers/products"
"online-order/api/middlewares"
"online-order/configs"
docs "online-order/docs"
"online-order/ent/migrate"
"online-order/entity"
)
@ -19,6 +21,25 @@ func init() {
configs.Initialize()
}
// @title Swagger Example API
// @version 1.0
// @description This is a sample server celler server.
// @termsOfService http://swagger.io/terms/
// @contact.name API Support
// @contact.url http://www.swagger.io/support
// @contact.email support@swagger.io
// @license.name Apache 2.0
// @license.url http://www.apache.org/licenses/LICENSE-2.0.html
// @host localhost:9000
// @BasePath /api/v1
// @securityDefinitions.basic BasicAuth
// @externalDocs.description OpenAPI
// @externalDocs.url https://swagger.io/resources/open-api/
func main() {
logger.Info().Msg("Server starting ...")
conf := configs.LoadConfigEnv()
@ -39,6 +60,9 @@ func main() {
}
app := gin.Default()
docs.SwaggerInfo.BasePath = "/api/v1"
api_v1 := app.Group("api/v1")
api_restricted := app.Group("api/v1/in")
@ -51,11 +75,18 @@ func main() {
RestrictedApp: api_restricted,
}
api_v1.Use(middlewares.DomainMiddleware(router))
//middlewareController := middlewares.NewMiddlewareRouters(router)
//api_restricted.Use(middlewareController.JwAuthtMiddleware())
handler_products.NewProductRouters(router)
logger.Info().Msg("Server ready to go ...")
app.Run(conf.ServerPort)
app.GET("/swagger/*any", ginSwagger.WrapHandler(swaggerfiles.Handler,
ginSwagger.URL("http://localhost:9000/swagger/doc.json"),
ginSwagger.DefaultModelsExpandDepth(-1)))
app.Run(":" + conf.ServerPort)
}

124
repository/domain/domain.go Normal file
View File

@ -0,0 +1,124 @@
package repository_domain
import (
"context"
"online-order/ent"
"online-order/ent/domain"
"online-order/entity"
)
type DomainClient struct {
client *ent.Client
}
func NewDomainClient(client *ent.Client) *DomainClient {
return &DomainClient{
client: client,
}
}
// List all domains
func (c *DomainClient) List() ([]*entity.DomainDisplay, error) {
var u []*entity.DomainDisplay
ctx := context.Background()
err := c.client.Domain.
Query().
Select(domain.FieldID, domain.FieldDomain, domain.FieldConfig, domain.FieldBusinessID, domain.FieldUserID, domain.FieldStatus, domain.FieldCreatedAt, domain.FieldUpdatedAt).
Scan(ctx, &u)
if err != nil {
return nil, err
}
return u, nil
}
// Create a domain
func (c *DomainClient) Create(p *entity.DomainCreateUpdate) error {
ctx := context.Background()
resp, err := c.client.Domain.
Create().
SetDomain(p.Domain).
SetStatus(p.Status).
SetBusinessID(p.BusinessID).
SetUserID(p.UserID).
SetStatus(p.Status).
Save(ctx)
if err != nil {
return err
}
p.ID = resp.ID
p.CreatedAt = resp.CreatedAt
p.UpdatedAt = resp.UpdatedAt
return nil
}
func (c *DomainClient) GetByID(id int) (*entity.DomainDisplay, error) {
var p entity.DomainDisplay
ctx := context.Background()
resp := c.client.Domain.
Query().
Where(domain.ID(id)).
AllX(ctx)
if len(resp) > 0 {
p.ID = resp[0].ID
p.Domain = resp[0].Domain
p.Status = resp[0].Status
p.CreatedAt = resp[0].CreatedAt
p.UpdatedAt = resp[0].UpdatedAt
} else {
return nil, entity.ErrNotFound
}
return &p, nil
}
func (c *DomainClient) GetByDomain(d string) (*entity.DomainDisplay, error) {
var p entity.DomainDisplay
ctx := context.Background()
resp := c.client.Domain.
Query().
Where(domain.DomainEQ(d)).
AllX(ctx)
if len(resp) > 0 {
p.ID = resp[0].ID
p.Domain = resp[0].Domain
p.Status = resp[0].Status
p.CreatedAt = resp[0].CreatedAt
p.UpdatedAt = resp[0].UpdatedAt
} else {
return nil, entity.ErrNotFound
}
return &p, nil
}
// Update domain information, except password
func (c *DomainClient) Update(p *entity.DomainCreateUpdate) error {
ctx := context.Background()
_, err := c.client.Domain.UpdateOneID(p.ID).
SetDomain(p.Domain).
SetConfig(p.Config).
SetStatus(p.Status).
Save(ctx)
if err != nil {
return err
}
return nil
}
// Update user information, except password
func (c *DomainClient) Delete(id int) error {
ctx := context.Background()
err := c.client.Domain.DeleteOneID(id).
Exec(ctx)
return err
}

49
usecase/domain/service.go Normal file
View File

@ -0,0 +1,49 @@
package service_domain
import (
"online-order/domain"
"online-order/entity"
)
type domainservice struct {
repo domain.DomainRepository
}
func NewDomainService(r domain.DomainRepository) *domainservice {
return &domainservice{
repo: r,
}
}
func (s *domainservice) List() ([]*entity.DomainDisplay, error) {
return s.repo.List()
}
func (s *domainservice) Create(u *entity.DomainCreateUpdate) error {
return s.repo.Create(u)
}
// Retrieve a domain
func (s *domainservice) GetByID(id int) (*entity.DomainDisplay, error) {
u, err := s.repo.GetByID(id)
if err != nil {
return &entity.DomainDisplay{}, entity.ErrNotFound
}
return u, nil
}
func (s *domainservice) Update(u *entity.DomainCreateUpdate) error {
return s.repo.Update(u)
}
func (s *domainservice) GetByDomain(d string) (*entity.DomainDisplay, error) {
u, err := s.repo.GetByDomain(d)
if err != nil {
return &entity.DomainDisplay{}, entity.ErrNotFound
}
return u, nil
}
func (s *domainservice) Delete(id int) error {
return s.repo.Delete(id)
}

View File

@ -15,9 +15,9 @@ type Response struct {
}
// Function used to parse API response
func ResponseJSON(c *gin.Context, httpCode, errCode int, msg string, data interface{}) {
func ResponseJSON(c *gin.Context, httpCode int, msg string, data interface{}) {
c.JSON(httpCode, Response{
Code: errCode,
Code: httpCode,
Message: msg,
Data: data,
})

18
utils/httputil/error.go Normal file
View File

@ -0,0 +1,18 @@
package httputil
import "github.com/gin-gonic/gin"
// NewError example
func NewError(ctx *gin.Context, status int, err error) {
er := HTTPError{
Code: status,
Message: err.Error(),
}
ctx.JSON(status, er)
}
// HTTPError example
type HTTPError struct {
Code int `json:"code" example:"400"`
Message string `json:"message" example:"status bad request"`
}