diff --git a/delivery/http_server/admin/admin/login.go b/delivery/http_server/admin/admin/login.go index 2b34ac6..9f90147 100644 --- a/delivery/http_server/admin/admin/login.go +++ b/delivery/http_server/admin/admin/login.go @@ -16,7 +16,7 @@ import ( // @Param Request body adminserviceparam.LoginWithPhoneNumberRequest true "Admin login request body" // @Success 200 {object} adminserviceparam.LoginWithPhoneNumberResponse // @Failure 400 {string} "Bad request" -// @Router /admins/login-by-phone [post] +// @Router /admins/login-by-phone [post]. func (h Handler) LoginByPhoneNumber(c echo.Context) error { var req adminserviceparam.LoginWithPhoneNumberRequest diff --git a/delivery/http_server/admin/admin/register.go b/delivery/http_server/admin/admin/register.go index cf5a782..71ca28f 100644 --- a/delivery/http_server/admin/admin/register.go +++ b/delivery/http_server/admin/admin/register.go @@ -17,7 +17,7 @@ import ( // @Success 200 {object} adminserviceparam.RegisterResponse // @Failure 400 {string} "Bad request" // @Security AuthBearerAdmin -// @Router /admins/register [post] +// @Router /admins/register [post]. func (h Handler) Register(c echo.Context) error { var req adminserviceparam.RegisterRequest diff --git a/delivery/http_server/admin/kind_box_req/accept.go b/delivery/http_server/admin/kind_box_req/accept.go index 6908e4d..e51346b 100644 --- a/delivery/http_server/admin/kind_box_req/accept.go +++ b/delivery/http_server/admin/kind_box_req/accept.go @@ -20,7 +20,7 @@ import ( // @Success 200 {object} param.KindBoxReqAcceptResponse // @Failure 400 {string} "Bad request" // @Security AuthBearerAdmin -// @Router /admin/kindboxreqs/accept-kind-box-req/{id} [patch] +// @Router /admin/kindboxreqs/accept-kind-box-req/{id} [patch]. func (h Handler) Accept(c echo.Context) error { var req param.KindBoxReqAcceptRequest if bErr := c.Bind(&req); bErr != nil { diff --git a/delivery/http_server/admin/kind_box_req/assign_sender_agent.go b/delivery/http_server/admin/kind_box_req/assign_sender_agent.go index 8c59779..69b2381 100644 --- a/delivery/http_server/admin/kind_box_req/assign_sender_agent.go +++ b/delivery/http_server/admin/kind_box_req/assign_sender_agent.go @@ -20,7 +20,7 @@ import ( // @Success 200 {object} param.AssignSenderResponse // @Failure 400 {string} "Bad request" // @Security AuthBearerAdmin -// @Router /admin/kindboxreqs/assign-sender-agent/{id} [patch] +// @Router /admin/kindboxreqs/assign-sender-agent/{id} [patch]. func (h Handler) AssignSenderAgent(c echo.Context) error { var req param.AssignSenderRequest diff --git a/delivery/http_server/admin/kind_box_req/deliver.go b/delivery/http_server/admin/kind_box_req/deliver.go index 0051f91..ca222a9 100644 --- a/delivery/http_server/admin/kind_box_req/deliver.go +++ b/delivery/http_server/admin/kind_box_req/deliver.go @@ -19,7 +19,7 @@ import ( // @Success 200 {object} param.DeliverKindBoxReqResponse // @Failure 400 {string} "Bad request" // @Security AuthBearerAdmin -// @Router /admin/kindboxreqs/deliver-kind-box-req/{id} [patch] +// @Router /admin/kindboxreqs/deliver-kind-box-req/{id} [patch]. func (h Handler) Deliver(c echo.Context) error { var req param.DeliverKindBoxReqRequest diff --git a/delivery/http_server/admin/kind_box_req/get_all.go b/delivery/http_server/admin/kind_box_req/get_all.go index 08f443e..560a09e 100644 --- a/delivery/http_server/admin/kind_box_req/get_all.go +++ b/delivery/http_server/admin/kind_box_req/get_all.go @@ -17,7 +17,7 @@ import ( // @Success 200 {object} param.KindBoxReqGetAllResponse // @Failure 400 {string} "Bad request" // @Security AuthBearerAdmin -// @Router /admin/kindboxreqs [get] +// @Router /admin/kindboxreqs [get]. func (h Handler) GetAll(c echo.Context) error { var req param.KindBoxReqGetAllRequest if bErr := c.Bind(&req); bErr != nil { diff --git a/delivery/http_server/admin/kind_box_req/reject.go b/delivery/http_server/admin/kind_box_req/reject.go index f3dc7d9..8020de1 100644 --- a/delivery/http_server/admin/kind_box_req/reject.go +++ b/delivery/http_server/admin/kind_box_req/reject.go @@ -20,7 +20,7 @@ import ( // @Success 200 {object} param.KindBoxReqRejectResponse // @Failure 400 {string} "Bad request" // @Security AuthBearerAdmin -// @Router /admin/kindboxreqs/reject-kind-box-req/{id} [patch] +// @Router /admin/kindboxreqs/reject-kind-box-req/{id} [patch]. func (h Handler) Reject(c echo.Context) error { var req param.KindBoxReqRejectRequest if bErr := c.Bind(&req); bErr != nil { diff --git a/delivery/http_server/admin/kind_box_req/route.go b/delivery/http_server/admin/kind_box_req/route.go index d45c264..be9bd8d 100644 --- a/delivery/http_server/admin/kind_box_req/route.go +++ b/delivery/http_server/admin/kind_box_req/route.go @@ -10,6 +10,7 @@ func (h Handler) SetRoutes(e *echo.Echo) { r := e.Group("/admin/kindboxreqs") r.Use(middleware.Auth(h.authSvc, h.authConfig)) + r.POST("", h.AddKindBoxReq, middleware.AdminAuthorization(h.adminAuthorizeSvc, entity.AdminKindBoxReqAddPermission)) r.PATCH("/accept-kind-box-req/:id", h.Accept, middleware.AdminAuthorization(h.adminAuthorizeSvc, entity.AdminKindBoxReqAcceptPermission)) r.PATCH("/reject-kind-box-req/:id", h.Reject, middleware.AdminAuthorization(h.adminAuthorizeSvc, entity.AdminKindBoxReqRejectPermission)) r.PATCH("/deliver-kind-box-req/:id", h.Deliver, middleware.AdminAuthorization(h.adminAuthorizeSvc, entity.AdminKindBoxReqDeliverPermission)) diff --git a/delivery/http_server/benefactor/address/add_address.go b/delivery/http_server/benefactor/address/add_address.go index 00badd6..27d5674 100644 --- a/delivery/http_server/benefactor/address/add_address.go +++ b/delivery/http_server/benefactor/address/add_address.go @@ -19,7 +19,7 @@ import ( // @Success 201 {object} param.BenefactorAddAddressResponse // @Failure 400 {string} "Bad request" // @Security AuthBearerBenefactor -// @Router /address/ [post] +// @Router /address/ [post]. func (h Handler) AddAddress(c echo.Context) error { req := param.BenefactorAddAddressRequest{} if bErr := c.Bind(&req); bErr != nil { diff --git a/delivery/http_server/benefactor/address/get.go b/delivery/http_server/benefactor/address/get.go index 15f1d45..b44e2b0 100644 --- a/delivery/http_server/benefactor/address/get.go +++ b/delivery/http_server/benefactor/address/get.go @@ -18,7 +18,7 @@ import ( // @Success 200 {object} param.GetAddressResponse // @Failure 400 {string} "Bad request" // @Security AuthBearerBenefactor -// @Router /address/{id} [get] +// @Router /address/{id} [get]. func (h Handler) GetAddress(c echo.Context) error { var req param.GetAddressRequest if bErr := echo.PathParamsBinder(c).Uint("id", &req.AddressID).BindError(); bErr != nil { diff --git a/delivery/http_server/benefactor/address/get_all.go b/delivery/http_server/benefactor/address/get_all.go index 8ac4375..a3d5d2e 100644 --- a/delivery/http_server/benefactor/address/get_all.go +++ b/delivery/http_server/benefactor/address/get_all.go @@ -17,7 +17,7 @@ import ( // @Success 200 {object} param.GetAllAddressesResponse // @Failure 400 {string} "Bad request" // @Security AuthBearerBenefactor -// @Router /address/ [get] +// @Router /address/ [get]. func (h Handler) GetAddresses(c echo.Context) error { var req param.GetAllAddressesRequest diff --git a/delivery/http_server/benefactor/address/get_all_cities.go b/delivery/http_server/benefactor/address/get_all_cities.go index 3fe2bf7..69257f9 100644 --- a/delivery/http_server/benefactor/address/get_all_cities.go +++ b/delivery/http_server/benefactor/address/get_all_cities.go @@ -15,7 +15,7 @@ import ( // @Produce json // @Success 200 {object} addressparam.GetAllCitiesResponse // @Failure 400 {string} "Bad request" -// @Router /address/cities [get] +// @Router /address/cities [get]. func (h Handler) GetAllCities(c echo.Context) error { var req addressparam.GetAllCitiesRequest diff --git a/delivery/http_server/benefactor/address/get_all_provinces.go b/delivery/http_server/benefactor/address/get_all_provinces.go index d54c30e..98bc6cc 100644 --- a/delivery/http_server/benefactor/address/get_all_provinces.go +++ b/delivery/http_server/benefactor/address/get_all_provinces.go @@ -15,7 +15,7 @@ import ( // @Produce json // @Success 200 {object} addressparam.GetAllProvincesResponse // @Failure 400 {string} "Bad request" -// @Router /address/provinces [get] +// @Router /address/provinces [get]. func (h Handler) GetAllProvinces(c echo.Context) error { var req addressparam.GetAllProvincesRequest diff --git a/delivery/http_server/benefactor/benefactor/login_register.go b/delivery/http_server/benefactor/benefactor/login_register.go index 2284952..b72de03 100644 --- a/delivery/http_server/benefactor/benefactor/login_register.go +++ b/delivery/http_server/benefactor/benefactor/login_register.go @@ -17,7 +17,7 @@ import ( // @Param Request body benefactoreparam.LoginOrRegisterRequest true "Login or register request details" // @Success 200 {object} benefactoreparam.LoginOrRegisterResponse // @Failure 400 {string} "Bad request" -// @Router /benefactor/login-register [post] +// @Router /benefactor/login-register [post]. func (h Handler) loginOrRegister(c echo.Context) error { var req benefactoreparam.LoginOrRegisterRequest diff --git a/delivery/http_server/benefactor/benefactor/send_otp.go b/delivery/http_server/benefactor/benefactor/send_otp.go index e65f7e2..a97f0ac 100644 --- a/delivery/http_server/benefactor/benefactor/send_otp.go +++ b/delivery/http_server/benefactor/benefactor/send_otp.go @@ -17,7 +17,7 @@ import ( // @Param Request body benefactoreparam.SendOtpRequest true "Send OTP request details" // @Success 200 {object} benefactoreparam.SendOtpResponse // @Failure 400 {string} "Bad request" -// @Router /benefactor/send-otp [post] +// @Router /benefactor/send-otp [post]. func (h Handler) SendOtp(c echo.Context) error { var req benefactoreparam.SendOtpRequest diff --git a/delivery/http_server/benefactor/kind_box/get.go b/delivery/http_server/benefactor/kind_box/get.go index 08f6510..b073f4b 100644 --- a/delivery/http_server/benefactor/kind_box/get.go +++ b/delivery/http_server/benefactor/kind_box/get.go @@ -18,7 +18,7 @@ import ( // @Success 200 {object} param.KindBoxGetResponse // @Failure 400 {string} "Bad request" // @Security AuthBearerBenefactor -// @Router /benefactor/kindboxes/{id} [get] +// @Router /benefactor/kindboxes/{id} [get]. func (h Handler) Get(c echo.Context) error { var req param.KindBoxGetRequest if bErr := c.Bind(&req); bErr != nil { diff --git a/delivery/http_server/benefactor/kind_box_req/add.go b/delivery/http_server/benefactor/kind_box_req/add.go index 03f84ff..3fed6f8 100644 --- a/delivery/http_server/benefactor/kind_box_req/add.go +++ b/delivery/http_server/benefactor/kind_box_req/add.go @@ -18,11 +18,10 @@ import ( // @Success 200 {object} param.KindBoxReqAddResponse // @Failure 400 {string} "Bad request" // @Security AuthBearerBenefactor -// @Router /benefactor/kindboxreqs/ [post] +// @Router /benefactor/kindboxreqs/ [post]. func (h Handler) Add(c echo.Context) error { req := param.KindBoxReqAddRequest{} if err := c.Bind(&req); err != nil { - return c.JSON(http.StatusBadRequest, echo.Map{ "message": errmsg.ErrBadRequest, }) diff --git a/delivery/http_server/benefactor/kind_box_req/delete.go b/delivery/http_server/benefactor/kind_box_req/delete.go index 647266a..a1e3aeb 100644 --- a/delivery/http_server/benefactor/kind_box_req/delete.go +++ b/delivery/http_server/benefactor/kind_box_req/delete.go @@ -1,11 +1,12 @@ package benefactorkindboxreqhandler import ( + "net/http" + param "git.gocasts.ir/ebhomengo/niki/param/benefactor/kind_box_req" "git.gocasts.ir/ebhomengo/niki/pkg/claim" httpmsg "git.gocasts.ir/ebhomengo/niki/pkg/http_msg" "github.com/labstack/echo/v4" - "net/http" ) // delete godoc @@ -18,11 +19,10 @@ import ( // @Success 200 {object} param.KindBoxReqDeleteResponse // @Failure 400 {string} "Bad request" // @Security AuthBearerBenefactor -// @Router /benefactor/kindboxreqs/{id} [delete] +// @Router /benefactor/kindboxreqs/{id} [delete]. func (h Handler) Delete(c echo.Context) error { req := param.KindBoxReqDeleteRequest{} if bErr := echo.PathParamsBinder(c).Uint("id", &req.KindBoxReqID).BindError(); bErr != nil { - return echo.NewHTTPError(http.StatusBadRequest) } claims := claim.GetClaimsFromEchoContext(c) diff --git a/delivery/http_server/benefactor/kind_box_req/get.go b/delivery/http_server/benefactor/kind_box_req/get.go index ebe862b..cd30630 100644 --- a/delivery/http_server/benefactor/kind_box_req/get.go +++ b/delivery/http_server/benefactor/kind_box_req/get.go @@ -18,7 +18,7 @@ import ( // @Success 200 {object} param.KindBoxReqGetResponse // @Failure 400 {string} "Bad request" // @Security AuthBearerBenefactor -// @Router /benefactor/kindboxreqs/{id} [get] +// @Router /benefactor/kindboxreqs/{id} [get]. func (h Handler) Get(c echo.Context) error { var req param.KindBoxReqGetRequest if bErr := echo.PathParamsBinder(c).Uint("id", &req.KindBoxReqID).BindError(); bErr != nil { diff --git a/delivery/http_server/server.go b/delivery/http_server/server.go index c79cd31..0ba982b 100644 --- a/delivery/http_server/server.go +++ b/delivery/http_server/server.go @@ -2,6 +2,7 @@ package httpserver import ( "fmt" + config "git.gocasts.ir/ebhomengo/niki/config" adminhandler "git.gocasts.ir/ebhomengo/niki/delivery/http_server/admin/admin" adminkindboxreqhandler "git.gocasts.ir/ebhomengo/niki/delivery/http_server/admin/kind_box_req" @@ -92,11 +93,11 @@ func (s Server) Serve() { } func RegisterSwagger(s *echo.Echo, config config.Config) { - //TODO: move this to a better place and make it more dynamic and configurable + // TODO: move this to a better place and make it more dynamic and configurable docs.SwaggerInfo.Title = "NIKI API" docs.SwaggerInfo.Description = "This is the API documentation for the NIKI project" docs.SwaggerInfo.Version = "1.0.0" - //docs.SwaggerInfo.BasePath = "/api/v1" + // docs.SwaggerInfo.BasePath = "/api/v1" docs.SwaggerInfo.Host = fmt.Sprintf("localhost:%d", config.HTTPServer.Port) s.GET("/swagger/*any", echoSwagger.WrapHandler) diff --git a/entity/admin_permission.go b/entity/admin_permission.go index 8807c31..7adc164 100644 --- a/entity/admin_permission.go +++ b/entity/admin_permission.go @@ -5,6 +5,7 @@ type AdminPermission string const ( AdminAdminRegisterPermission = AdminPermission("admin-register") AdminKindBoxReqAcceptPermission = AdminPermission("kindboxreq-accept") + AdminKindBoxReqAddPermission = AdminPermission("kindboxreq-add") AdminKindBoxReqRejectPermission = AdminPermission("kindboxreq-reject") AdminKindBoxReqGetAllPermission = AdminPermission("kindboxreq-getall") AdminKindBoxReqDeliverPermission = AdminPermission("kindboxreq-deliver") diff --git a/go.mod b/go.mod index 8b012c6..8337287 100644 --- a/go.mod +++ b/go.mod @@ -16,6 +16,7 @@ require ( github.com/rubenv/sql-migrate v1.6.0 github.com/stretchr/testify v1.9.0 github.com/swaggo/echo-swagger v1.4.1 + github.com/swaggo/swag v1.16.3 golang.org/x/crypto v0.23.0 gopkg.in/natefinch/lumberjack.v2 v2.2.1 ) @@ -46,7 +47,6 @@ require ( github.com/mitchellh/reflectwalk v1.0.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/swaggo/files/v2 v2.0.0 // indirect - github.com/swaggo/swag v1.16.3 // indirect github.com/valyala/bytebufferpool v1.0.0 // indirect github.com/valyala/fasttemplate v1.2.2 // indirect golang.org/x/net v0.25.0 // indirect diff --git a/param/admin/kind_box/add.go b/param/admin/kind_box/add.go index 483dde2..358b56d 100644 --- a/param/admin/kind_box/add.go +++ b/param/admin/kind_box/add.go @@ -1,8 +1,9 @@ package adminkindboxparam import ( - entity "git.gocasts.ir/ebhomengo/niki/entity" "time" + + entity "git.gocasts.ir/ebhomengo/niki/entity" ) type AddKindBoxRequest struct { diff --git a/param/admin/kind_box_req/add.go b/param/admin/kind_box_req/add.go index 01b5f73..24f0c43 100644 --- a/param/admin/kind_box_req/add.go +++ b/param/admin/kind_box_req/add.go @@ -3,9 +3,11 @@ package adminkindboxreqparam import entity "git.gocasts.ir/ebhomengo/niki/entity" type KindBoxReqAddRequest struct { - BenefactorID uint - TypeID uint - CountRequested uint + BenefactorID uint `json:"benefactor_id" example:"1"` + TypeID entity.KindBoxType `json:"type_id" example:"1"` + DeliverAddressID uint `json:"deliver_address_id" example:"1"` + DeliverReferDate string `json:"deliver_refer_date" example:"2025-01-02 15:04:05"` + CountRequested uint `json:"count_requested" example:"2"` } type KindBoxReqAddResponse struct { diff --git a/repository/mysql/admin/create.go b/repository/mysql/admin/create.go index d51b06a..96ed635 100644 --- a/repository/mysql/admin/create.go +++ b/repository/mysql/admin/create.go @@ -2,6 +2,7 @@ package mysqladmin import ( "context" + "git.gocasts.ir/ebhomengo/niki/entity" errmsg "git.gocasts.ir/ebhomengo/niki/pkg/err_msg" richerror "git.gocasts.ir/ebhomengo/niki/pkg/rich_error" diff --git a/repository/mysql/benefactor/exist_benefactor.go b/repository/mysql/benefactor/exist_benefactor.go index 6a68e84..35a75ab 100644 --- a/repository/mysql/benefactor/exist_benefactor.go +++ b/repository/mysql/benefactor/exist_benefactor.go @@ -4,11 +4,12 @@ import ( "context" "database/sql" "errors" + "time" + "git.gocasts.ir/ebhomengo/niki/entity" errmsg "git.gocasts.ir/ebhomengo/niki/pkg/err_msg" richerror "git.gocasts.ir/ebhomengo/niki/pkg/rich_error" "git.gocasts.ir/ebhomengo/niki/repository/mysql" - "time" ) func (d DB) IsExistBenefactorByPhoneNumber(ctx context.Context, phoneNumber string) (bool, entity.Benefactor, error) { @@ -56,7 +57,6 @@ func (d *DB) IsExistBenefactorByID(ctx context.Context, id uint) (bool, error) { } func scanBenefactor(scanner mysql.Scanner) (entity.Benefactor, error) { - var createdAt, updatedAt time.Time var benefactor entity.Benefactor // TODO - use db model and mapper between entity and db model OR use this approach diff --git a/repository/mysql/kind_box_req/accept.go b/repository/mysql/kind_box_req/accept.go index 7328802..3799d7e 100644 --- a/repository/mysql/kind_box_req/accept.go +++ b/repository/mysql/kind_box_req/accept.go @@ -2,6 +2,7 @@ package mysqlkindboxreq import ( "context" + "git.gocasts.ir/ebhomengo/niki/entity" errmsg "git.gocasts.ir/ebhomengo/niki/pkg/err_msg" richerror "git.gocasts.ir/ebhomengo/niki/pkg/rich_error" diff --git a/repository/mysql/kind_box_req/add.go b/repository/mysql/kind_box_req/add.go index 83063c5..f366039 100644 --- a/repository/mysql/kind_box_req/add.go +++ b/repository/mysql/kind_box_req/add.go @@ -2,6 +2,7 @@ package mysqlkindboxreq import ( "context" + "git.gocasts.ir/ebhomengo/niki/entity" errmsg "git.gocasts.ir/ebhomengo/niki/pkg/err_msg" richerror "git.gocasts.ir/ebhomengo/niki/pkg/rich_error" diff --git a/repository/mysql/kind_box_req/assign_sender_agent.go b/repository/mysql/kind_box_req/assign_sender_agent.go index 14d56b9..d0b5c11 100644 --- a/repository/mysql/kind_box_req/assign_sender_agent.go +++ b/repository/mysql/kind_box_req/assign_sender_agent.go @@ -2,6 +2,7 @@ package mysqlkindboxreq import ( "context" + entity "git.gocasts.ir/ebhomengo/niki/entity" errmsg "git.gocasts.ir/ebhomengo/niki/pkg/err_msg" richerror "git.gocasts.ir/ebhomengo/niki/pkg/rich_error" diff --git a/repository/mysql/kind_box_req/delete.go b/repository/mysql/kind_box_req/delete.go index 3d62192..0db9554 100644 --- a/repository/mysql/kind_box_req/delete.go +++ b/repository/mysql/kind_box_req/delete.go @@ -2,9 +2,10 @@ package mysqlkindboxreq import ( "context" + "time" + errmsg "git.gocasts.ir/ebhomengo/niki/pkg/err_msg" richerror "git.gocasts.ir/ebhomengo/niki/pkg/rich_error" - "time" ) func (d DB) DeleteKindBoxReqByID(ctx context.Context, kindBoxReqID uint) error { diff --git a/repository/mysql/kind_box_req/get.go b/repository/mysql/kind_box_req/get.go index f4dce29..cf595ea 100644 --- a/repository/mysql/kind_box_req/get.go +++ b/repository/mysql/kind_box_req/get.go @@ -3,6 +3,7 @@ package mysqlkindboxreq import ( "context" "database/sql" + "git.gocasts.ir/ebhomengo/niki/entity" errmsg "git.gocasts.ir/ebhomengo/niki/pkg/err_msg" richerror "git.gocasts.ir/ebhomengo/niki/pkg/rich_error" diff --git a/repository/mysql/kind_box_req/kind_box_req.go b/repository/mysql/kind_box_req/kind_box_req.go index ce32b2a..c58d3d5 100644 --- a/repository/mysql/kind_box_req/kind_box_req.go +++ b/repository/mysql/kind_box_req/kind_box_req.go @@ -4,6 +4,7 @@ import ( "context" "database/sql" "errors" + "git.gocasts.ir/ebhomengo/niki/entity" errmsg "git.gocasts.ir/ebhomengo/niki/pkg/err_msg" richerror "git.gocasts.ir/ebhomengo/niki/pkg/rich_error" diff --git a/repository/mysql/kind_box_req/reject.go b/repository/mysql/kind_box_req/reject.go index 2fc3a30..5db7a42 100644 --- a/repository/mysql/kind_box_req/reject.go +++ b/repository/mysql/kind_box_req/reject.go @@ -2,6 +2,7 @@ package mysqlkindboxreq import ( "context" + "git.gocasts.ir/ebhomengo/niki/entity" errmsg "git.gocasts.ir/ebhomengo/niki/pkg/err_msg" richerror "git.gocasts.ir/ebhomengo/niki/pkg/rich_error" diff --git a/service/admin/admin/service.go b/service/admin/admin/service.go index 5921ba4..6811972 100644 --- a/service/admin/admin/service.go +++ b/service/admin/admin/service.go @@ -19,6 +19,8 @@ type Repository interface { GetAdminByPhoneNumber(ctx context.Context, phoneNumber string) (entity.Admin, error) GetAdminByID(ctx context.Context, adminID uint) (entity.Admin, error) GetAllAgent(ctx context.Context) ([]entity.Admin, error) + IsExistBenefactorByID(ctx context.Context, id uint) (bool, error) + GetAddressByID(ctx context.Context, id uint) (*entity.Address, error) } type Service struct { diff --git a/service/admin/kind_box_req/service.go b/service/admin/kind_box_req/service.go index 4d7cc95..4f13686 100644 --- a/service/admin/kind_box_req/service.go +++ b/service/admin/kind_box_req/service.go @@ -17,6 +17,7 @@ type Repository interface { DeliverKindBoxReq(ctx context.Context, kindBoxReqID uint) error GetAllKindBoxReq(ctx context.Context, filter params.FilterRequest, pagination params.PaginationRequest, sort params.SortRequest) ([]entity.KindBoxReq, uint, error) GetAwaitingDeliveryByAgent(ctx context.Context, kindBoxReqID uint, agentID uint) (entity.KindBoxReq, error) + AddKindBoxReq(ctx context.Context, kindBoxReq entity.KindBoxReq) (entity.KindBoxReq, error) } type KindBoxSvc interface { diff --git a/service/benefactor/address/get.go b/service/benefactor/address/get.go index 48a78c3..5ad5ade 100644 --- a/service/benefactor/address/get.go +++ b/service/benefactor/address/get.go @@ -2,6 +2,7 @@ package benefactoraddressservice import ( "context" + param "git.gocasts.ir/ebhomengo/niki/param/benefactor/address" richerror "git.gocasts.ir/ebhomengo/niki/pkg/rich_error" ) diff --git a/service/benefactor/kind_box_req/delete.go b/service/benefactor/kind_box_req/delete.go index ff3c546..becedd0 100644 --- a/service/benefactor/kind_box_req/delete.go +++ b/service/benefactor/kind_box_req/delete.go @@ -2,6 +2,7 @@ package benefactorkindboxreqservice import ( "context" + param "git.gocasts.ir/ebhomengo/niki/param/benefactor/kind_box_req" richerror "git.gocasts.ir/ebhomengo/niki/pkg/rich_error" ) diff --git a/test/db.go b/test/db.go index 6729436..984c279 100644 --- a/test/db.go +++ b/test/db.go @@ -6,7 +6,6 @@ import ( "git.gocasts.ir/ebhomengo/niki/repository/migrator" "git.gocasts.ir/ebhomengo/niki/repository/mysql" - //nolint _ "github.com/go-sql-driver/mysql" ) diff --git a/test/end2end.go b/test/end2end.go index 3edfcab..bb94242 100644 --- a/test/end2end.go +++ b/test/end2end.go @@ -72,7 +72,7 @@ func SendOTP(t *testing.T) benefactoreparam.SendOtpResponse { return resp } -//nolint +// nolint func CreateBenefactorWithSvc(t *testing.T, req benefactoreparam.LoginOrRegisterRequest) (benefactoreparam.LoginOrRegisterResponse, func()) { t.Helper() ctx := context.Background() @@ -88,7 +88,7 @@ func CreateBenefactorWithSvc(t *testing.T, req benefactoreparam.LoginOrRegisterR } } -//nolint +// nolint func CreateAddressWithSvc(t *testing.T, req addressparam.BenefactorAddAddressRequest) (addressparam.BenefactorAddAddressResponse, func()) { t.Helper() ctx := context.Background() diff --git a/test/mock/benefactor_kind_box_req_mock.go b/test/mock/benefactor_kind_box_req_mock.go index 5ecec65..54abf3a 100644 --- a/test/mock/benefactor_kind_box_req_mock.go +++ b/test/mock/benefactor_kind_box_req_mock.go @@ -52,7 +52,7 @@ func NewMockRepository(hasErr bool) *MockRepository { } } -//nolint +// nolint func (m *MockRepository) AddKindBoxReq(ctx context.Context, kindBoxReq entity.KindBoxReq) (entity.KindBoxReq, error) { if m.hasErr { return entity.KindBoxReq{}, fmt.Errorf(RepoErr) diff --git a/test/seed/kind_box_req.go b/test/seed/kind_box_req.go index c0921c4..b1f7c66 100644 --- a/test/seed/kind_box_req.go +++ b/test/seed/kind_box_req.go @@ -11,7 +11,7 @@ import ( "github.com/stretchr/testify/assert" ) -//nolint +// nolint func CreateBenefactor(t *testing.T, db *mysql.DB) (*entity.Benefactor, func()) { t.Helper() benefactor := &entity.Benefactor{ @@ -42,7 +42,7 @@ func CreateBenefactor(t *testing.T, db *mysql.DB) (*entity.Benefactor, func()) { } } -//nolint +// nolint func CreateAddress(t *testing.T, db *mysql.DB, benfactorID uint) (*entity.Address, func()) { t.Helper() address := &entity.Address{ diff --git a/validator/admin/kind_box_req/validator.go b/validator/admin/kind_box_req/validator.go index 961c4ca..fddc1a8 100644 --- a/validator/admin/kind_box_req/validator.go +++ b/validator/admin/kind_box_req/validator.go @@ -25,11 +25,17 @@ type Repository interface { type AdminSvc interface { AdminExistByID(ctx context.Context, req param.AdminExistByIDRequest) (param.AdminExistByIDResponse, error) + BenefactorExistByID(ctx context.Context, request param.BenefactorExistByIDRequest) (param.BenefactorExistByIDResponse, error) +} + +type AddressSvc interface { + AddressExistByID(ctx context.Context, request param.GetAddressByIDRequest) (param.GetAddressByIDResponse, error) } type Validator struct { - repo Repository - adminSvc AdminSvc + repo Repository + adminSvc AdminSvc + addressSvc AddressSvc } func New(repo Repository, adminSvc AdminSvc) Validator { diff --git a/validator/benefactor/kind_box_req/add.go b/validator/benefactor/kind_box_req/add.go index f37c402..7c2e7d4 100644 --- a/validator/benefactor/kind_box_req/add.go +++ b/validator/benefactor/kind_box_req/add.go @@ -2,6 +2,7 @@ package benefactorkindboxreqvalidator import ( "errors" + param "git.gocasts.ir/ebhomengo/niki/param/benefactor/kind_box_req" errmsg "git.gocasts.ir/ebhomengo/niki/pkg/err_msg" richerror "git.gocasts.ir/ebhomengo/niki/pkg/rich_error" diff --git a/validator/benefactor/kind_box_req/validator.go b/validator/benefactor/kind_box_req/validator.go index feb1609..5b17640 100644 --- a/validator/benefactor/kind_box_req/validator.go +++ b/validator/benefactor/kind_box_req/validator.go @@ -3,13 +3,14 @@ package benefactorkindboxreqvalidator import ( "context" "fmt" + "time" + "git.gocasts.ir/ebhomengo/niki/entity" refertimeparam "git.gocasts.ir/ebhomengo/niki/param/admin/refer_time" addressparam "git.gocasts.ir/ebhomengo/niki/param/benefactor/address" param "git.gocasts.ir/ebhomengo/niki/param/benefactor/benefactore" errmsg "git.gocasts.ir/ebhomengo/niki/pkg/err_msg" validation "github.com/go-ozzo/ozzo-validation/v4" - "time" ) const ( diff --git a/vendor/github.com/KyleBanks/depth/depth.go b/vendor/github.com/KyleBanks/depth/depth.go index 115c28a..75f7ea9 100644 --- a/vendor/github.com/KyleBanks/depth/depth.go +++ b/vendor/github.com/KyleBanks/depth/depth.go @@ -3,27 +3,27 @@ // // For example, the dependencies of the stdlib `strings` package can be resolved like so: // -// import "github.com/KyleBanks/depth" +// import "github.com/KyleBanks/depth" // // var t depth.Tree -// err := t.Resolve("strings") -// if err != nil { -// log.Fatal(err) -// } +// err := t.Resolve("strings") +// if err != nil { +// log.Fatal(err) +// } // -// // Output: "strings has 4 dependencies." -// log.Printf("%v has %v dependencies.", t.Root.Name, len(t.Root.Deps)) +// // Output: "strings has 4 dependencies." +// log.Printf("%v has %v dependencies.", t.Root.Name, len(t.Root.Deps)) // // For additional customization, simply set the appropriate flags on the `Tree` before resolving: // -// import "github.com/KyleBanks/depth" +// import "github.com/KyleBanks/depth" // -// t := depth.Tree { -// ResolveInternal: true, -// ResolveTest: true, -// MaxDepth: 10, -// } -// err := t.Resolve("strings") +// t := depth.Tree { +// ResolveInternal: true, +// ResolveTest: true, +// MaxDepth: 10, +// } +// err := t.Resolve("strings") package depth import ( diff --git a/vendor/github.com/asaskevich/govalidator/types.go b/vendor/github.com/asaskevich/govalidator/types.go index f42a346..62f8b0d 100644 --- a/vendor/github.com/asaskevich/govalidator/types.go +++ b/vendor/github.com/asaskevich/govalidator/types.go @@ -72,13 +72,13 @@ var ParamTagMap = map[string]ParamValidator{ // ParamTagRegexMap maps param tags to their respective regexes. var ParamTagRegexMap = map[string]*regexp.Regexp{ - "range": regexp.MustCompile("^range\\((\\d+)\\|(\\d+)\\)$"), - "length": regexp.MustCompile("^length\\((\\d+)\\|(\\d+)\\)$"), - "runelength": regexp.MustCompile("^runelength\\((\\d+)\\|(\\d+)\\)$"), - "stringlength": regexp.MustCompile("^stringlength\\((\\d+)\\|(\\d+)\\)$"), - "in": regexp.MustCompile(`^in\((.*)\)`), - "matches": regexp.MustCompile(`^matches\((.+)\)$`), - "rsapub": regexp.MustCompile("^rsapub\\((\\d+)\\)$"), + "range": regexp.MustCompile("^range\\((\\d+)\\|(\\d+)\\)$"), + "length": regexp.MustCompile("^length\\((\\d+)\\|(\\d+)\\)$"), + "runelength": regexp.MustCompile("^runelength\\((\\d+)\\|(\\d+)\\)$"), + "stringlength": regexp.MustCompile("^stringlength\\((\\d+)\\|(\\d+)\\)$"), + "in": regexp.MustCompile(`^in\((.*)\)`), + "matches": regexp.MustCompile(`^matches\((.+)\)$`), + "rsapub": regexp.MustCompile("^rsapub\\((\\d+)\\)$"), "minstringlength": regexp.MustCompile("^minstringlength\\((\\d+)\\)$"), "maxstringlength": regexp.MustCompile("^maxstringlength\\((\\d+)\\)$"), } @@ -173,7 +173,7 @@ type ISO3166Entry struct { Numeric string } -//ISO3166List based on https://www.iso.org/obp/ui/#search/code/ Code Type "Officially Assigned Codes" +// ISO3166List based on https://www.iso.org/obp/ui/#search/code/ Code Type "Officially Assigned Codes" var ISO3166List = []ISO3166Entry{ {"Afghanistan", "Afghanistan (l')", "AF", "AFG", "004"}, {"Albania", "Albanie (l')", "AL", "ALB", "008"}, @@ -463,7 +463,7 @@ type ISO693Entry struct { English string } -//ISO693List based on http://data.okfn.org/data/core/language-codes/r/language-codes-3b2.json +// ISO693List based on http://data.okfn.org/data/core/language-codes/r/language-codes-3b2.json var ISO693List = []ISO693Entry{ {Alpha3bCode: "aar", Alpha2Code: "aa", English: "Afar"}, {Alpha3bCode: "abk", Alpha2Code: "ab", English: "Abkhazian"}, diff --git a/vendor/github.com/asaskevich/govalidator/validator.go b/vendor/github.com/asaskevich/govalidator/validator.go index 14682e0..439a45d 100644 --- a/vendor/github.com/asaskevich/govalidator/validator.go +++ b/vendor/github.com/asaskevich/govalidator/validator.go @@ -37,25 +37,32 @@ const RF3339WithoutZone = "2006-01-02T15:04:05" // SetFieldsRequiredByDefault causes validation to fail when struct fields // do not include validations or are not explicitly marked as exempt (using `valid:"-"` or `valid:"email,optional"`). // This struct definition will fail govalidator.ValidateStruct() (and the field values do not matter): -// type exampleStruct struct { -// Name string `` -// Email string `valid:"email"` +// +// type exampleStruct struct { +// Name string `` +// Email string `valid:"email"` +// // This, however, will only fail when Email is empty or an invalid email address: -// type exampleStruct2 struct { -// Name string `valid:"-"` -// Email string `valid:"email"` +// +// type exampleStruct2 struct { +// Name string `valid:"-"` +// Email string `valid:"email"` +// // Lastly, this will only fail when Email is an invalid email address but not when it's empty: -// type exampleStruct2 struct { -// Name string `valid:"-"` -// Email string `valid:"email,optional"` +// +// type exampleStruct2 struct { +// Name string `valid:"-"` +// Email string `valid:"email,optional"` func SetFieldsRequiredByDefault(value bool) { fieldsRequiredByDefault = value } // SetNilPtrAllowedByRequired causes validation to pass for nil ptrs when a field is set to required. // The validation will still reject ptr fields in their zero value state. Example with this enabled: -// type exampleStruct struct { -// Name *string `valid:"required"` +// +// type exampleStruct struct { +// Name *string `valid:"required"` +// // With `Name` set to "", this will be considered invalid input and will cause a validation error. // With `Name` set to nil, this will be considered valid by validation. // By default this is disabled. @@ -154,8 +161,8 @@ func IsAlpha(str string) bool { return rxAlpha.MatchString(str) } -//IsUTFLetter check if the string contains only unicode letter characters. -//Similar to IsAlpha but for all languages. Empty string is valid. +// IsUTFLetter check if the string contains only unicode letter characters. +// Similar to IsAlpha but for all languages. Empty string is valid. func IsUTFLetter(str string) bool { if IsNull(str) { return true diff --git a/vendor/github.com/brianvoe/gofakeit/v6/template.go b/vendor/github.com/brianvoe/gofakeit/v6/template.go index 329d6f7..37ca879 100644 --- a/vendor/github.com/brianvoe/gofakeit/v6/template.go +++ b/vendor/github.com/brianvoe/gofakeit/v6/template.go @@ -3,13 +3,12 @@ package gofakeit import ( "bytes" "fmt" - "strconv" - "time" - "math/rand" "reflect" + "strconv" "strings" "text/template" + "time" ) // TemplateOptions defines values needed for template document generation diff --git a/vendor/github.com/davecgh/go-spew/spew/bypass.go b/vendor/github.com/davecgh/go-spew/spew/bypass.go index 7929947..70ddeaa 100644 --- a/vendor/github.com/davecgh/go-spew/spew/bypass.go +++ b/vendor/github.com/davecgh/go-spew/spew/bypass.go @@ -18,6 +18,7 @@ // tag is deprecated and thus should not be used. // Go versions prior to 1.4 are disabled because they use a different layout // for interfaces which make the implementation of unsafeReflectValue more complex. +//go:build !js && !appengine && !safe && !disableunsafe && go1.4 // +build !js,!appengine,!safe,!disableunsafe,go1.4 package spew diff --git a/vendor/github.com/davecgh/go-spew/spew/config.go b/vendor/github.com/davecgh/go-spew/spew/config.go index 2e3d22f..161895f 100644 --- a/vendor/github.com/davecgh/go-spew/spew/config.go +++ b/vendor/github.com/davecgh/go-spew/spew/config.go @@ -254,15 +254,15 @@ pointer addresses used to indirect to the final value. It provides the following features over the built-in printing facilities provided by the fmt package: - * Pointers are dereferenced and followed - * Circular data structures are detected and handled properly - * Custom Stringer/error interfaces are optionally invoked, including - on unexported types - * Custom types which only implement the Stringer/error interfaces via - a pointer receiver are optionally invoked when passing non-pointer - variables - * Byte arrays and slices are dumped like the hexdump -C command which - includes offsets, byte values in hex, and ASCII output + - Pointers are dereferenced and followed + - Circular data structures are detected and handled properly + - Custom Stringer/error interfaces are optionally invoked, including + on unexported types + - Custom types which only implement the Stringer/error interfaces via + a pointer receiver are optionally invoked when passing non-pointer + variables + - Byte arrays and slices are dumped like the hexdump -C command which + includes offsets, byte values in hex, and ASCII output The configuration options are controlled by modifying the public members of c. See ConfigState for options documentation. @@ -295,12 +295,12 @@ func (c *ConfigState) convertArgs(args []interface{}) (formatters []interface{}) // NewDefaultConfig returns a ConfigState with the following default settings. // -// Indent: " " -// MaxDepth: 0 -// DisableMethods: false -// DisablePointerMethods: false -// ContinueOnMethod: false -// SortKeys: false +// Indent: " " +// MaxDepth: 0 +// DisableMethods: false +// DisablePointerMethods: false +// ContinueOnMethod: false +// SortKeys: false func NewDefaultConfig() *ConfigState { return &ConfigState{Indent: " "} } diff --git a/vendor/github.com/davecgh/go-spew/spew/dump.go b/vendor/github.com/davecgh/go-spew/spew/dump.go index f78d89f..8323041 100644 --- a/vendor/github.com/davecgh/go-spew/spew/dump.go +++ b/vendor/github.com/davecgh/go-spew/spew/dump.go @@ -488,15 +488,15 @@ pointer addresses used to indirect to the final value. It provides the following features over the built-in printing facilities provided by the fmt package: - * Pointers are dereferenced and followed - * Circular data structures are detected and handled properly - * Custom Stringer/error interfaces are optionally invoked, including - on unexported types - * Custom types which only implement the Stringer/error interfaces via - a pointer receiver are optionally invoked when passing non-pointer - variables - * Byte arrays and slices are dumped like the hexdump -C command which - includes offsets, byte values in hex, and ASCII output + - Pointers are dereferenced and followed + - Circular data structures are detected and handled properly + - Custom Stringer/error interfaces are optionally invoked, including + on unexported types + - Custom types which only implement the Stringer/error interfaces via + a pointer receiver are optionally invoked when passing non-pointer + variables + - Byte arrays and slices are dumped like the hexdump -C command which + includes offsets, byte values in hex, and ASCII output The configuration options are controlled by an exported package global, spew.Config. See ConfigState for options documentation. diff --git a/vendor/github.com/fatih/structs/field.go b/vendor/github.com/fatih/structs/field.go index e697832..23270e0 100644 --- a/vendor/github.com/fatih/structs/field.go +++ b/vendor/github.com/fatih/structs/field.go @@ -95,8 +95,8 @@ func (f *Field) Zero() error { // of a nested struct . A struct tag with the content of "-" ignores the // checking of that particular field. Example: // -// // Field is ignored by this package. -// Field *http.Request `structs:"-"` +// // Field is ignored by this package. +// Field *http.Request `structs:"-"` // // It panics if field is not exported or if field's kind is not struct func (f *Field) Fields() []*Field { diff --git a/vendor/github.com/fatih/structs/structs.go b/vendor/github.com/fatih/structs/structs.go index 3a87706..7970aa0 100644 --- a/vendor/github.com/fatih/structs/structs.go +++ b/vendor/github.com/fatih/structs/structs.go @@ -3,7 +3,6 @@ package structs import ( "fmt" - "reflect" ) @@ -38,43 +37,43 @@ func New(s interface{}) *Struct { // can be changed in the struct field's tag value. The "structs" key in the // struct's field tag value is the key name. Example: // -// // Field appears in map as key "myName". -// Name string `structs:"myName"` +// // Field appears in map as key "myName". +// Name string `structs:"myName"` // // A tag value with the content of "-" ignores that particular field. Example: // -// // Field is ignored by this package. -// Field bool `structs:"-"` +// // Field is ignored by this package. +// Field bool `structs:"-"` // // A tag value with the content of "string" uses the stringer to get the value. Example: // -// // The value will be output of Animal's String() func. -// // Map will panic if Animal does not implement String(). -// Field *Animal `structs:"field,string"` +// // The value will be output of Animal's String() func. +// // Map will panic if Animal does not implement String(). +// Field *Animal `structs:"field,string"` // // A tag value with the option of "flatten" used in a struct field is to flatten its fields // in the output map. Example: // -// // The FieldStruct's fields will be flattened into the output map. -// FieldStruct time.Time `structs:",flatten"` +// // The FieldStruct's fields will be flattened into the output map. +// FieldStruct time.Time `structs:",flatten"` // // A tag value with the option of "omitnested" stops iterating further if the type // is a struct. Example: // -// // Field is not processed further by this package. -// Field time.Time `structs:"myName,omitnested"` -// Field *http.Request `structs:",omitnested"` +// // Field is not processed further by this package. +// Field time.Time `structs:"myName,omitnested"` +// Field *http.Request `structs:",omitnested"` // // A tag value with the option of "omitempty" ignores that particular field if // the field value is empty. Example: // -// // Field appears in map as key "myName", but the field is -// // skipped if empty. -// Field string `structs:"myName,omitempty"` +// // Field appears in map as key "myName", but the field is +// // skipped if empty. +// Field string `structs:"myName,omitempty"` // -// // Field appears in map as key "Field" (the default), but -// // the field is skipped if empty. -// Field string `structs:",omitempty"` +// // Field appears in map as key "Field" (the default), but +// // the field is skipped if empty. +// Field string `structs:",omitempty"` // // Note that only exported fields of a struct can be accessed, non exported // fields will be neglected. @@ -153,21 +152,21 @@ func (s *Struct) FillMap(out map[string]interface{}) { // struct tag with the content of "-" ignores the that particular field. // Example: // -// // Field is ignored by this package. -// Field int `structs:"-"` +// // Field is ignored by this package. +// Field int `structs:"-"` // // A value with the option of "omitnested" stops iterating further if the type // is a struct. Example: // -// // Fields is not processed further by this package. -// Field time.Time `structs:",omitnested"` -// Field *http.Request `structs:",omitnested"` +// // Fields is not processed further by this package. +// Field time.Time `structs:",omitnested"` +// Field *http.Request `structs:",omitnested"` // // A tag value with the option of "omitempty" ignores that particular field and // is not added to the values if the field value is empty. Example: // -// // Field is skipped if empty -// Field string `structs:",omitempty"` +// // Field is skipped if empty +// Field string `structs:",omitempty"` // // Note that only exported fields of a struct can be accessed, non exported // fields will be neglected. @@ -215,8 +214,8 @@ func (s *Struct) Values() []interface{} { // Fields returns a slice of Fields. A struct tag with the content of "-" // ignores the checking of that particular field. Example: // -// // Field is ignored by this package. -// Field bool `structs:"-"` +// // Field is ignored by this package. +// Field bool `structs:"-"` // // It panics if s's kind is not struct. func (s *Struct) Fields() []*Field { @@ -226,8 +225,8 @@ func (s *Struct) Fields() []*Field { // Names returns a slice of field names. A struct tag with the content of "-" // ignores the checking of that particular field. Example: // -// // Field is ignored by this package. -// Field bool `structs:"-"` +// // Field is ignored by this package. +// Field bool `structs:"-"` // // It panics if s's kind is not struct. func (s *Struct) Names() []string { @@ -303,15 +302,15 @@ func (s *Struct) FieldOk(name string) (*Field, bool) { // initialized) A struct tag with the content of "-" ignores the checking of // that particular field. Example: // -// // Field is ignored by this package. -// Field bool `structs:"-"` +// // Field is ignored by this package. +// Field bool `structs:"-"` // // A value with the option of "omitnested" stops iterating further if the type // is a struct. Example: // -// // Field is not processed further by this package. -// Field time.Time `structs:"myName,omitnested"` -// Field *http.Request `structs:",omitnested"` +// // Field is not processed further by this package. +// Field time.Time `structs:"myName,omitnested"` +// Field *http.Request `structs:",omitnested"` // // Note that only exported fields of a struct can be accessed, non exported // fields will be neglected. It panics if s's kind is not struct. @@ -350,15 +349,15 @@ func (s *Struct) IsZero() bool { // A struct tag with the content of "-" ignores the checking of that particular // field. Example: // -// // Field is ignored by this package. -// Field bool `structs:"-"` +// // Field is ignored by this package. +// Field bool `structs:"-"` // // A value with the option of "omitnested" stops iterating further if the type // is a struct. Example: // -// // Field is not processed further by this package. -// Field time.Time `structs:"myName,omitnested"` -// Field *http.Request `structs:",omitnested"` +// // Field is not processed further by this package. +// Field time.Time `structs:"myName,omitnested"` +// Field *http.Request `structs:",omitnested"` // // Note that only exported fields of a struct can be accessed, non exported // fields will be neglected. It panics if s's kind is not struct. diff --git a/vendor/github.com/ghodss/yaml/fields.go b/vendor/github.com/ghodss/yaml/fields.go index 5860074..5e36e56 100644 --- a/vendor/github.com/ghodss/yaml/fields.go +++ b/vendor/github.com/ghodss/yaml/fields.go @@ -347,8 +347,9 @@ const ( // 4) simpleLetterEqualFold, no specials, no non-letters. // // The letters S and K are special because they map to 3 runes, not just 2: -// * S maps to s and to U+017F 'ſ' Latin small letter long s -// * k maps to K and to U+212A 'K' Kelvin sign +// - S maps to s and to U+017F 'ſ' Latin small letter long s +// - k maps to K and to U+212A 'K' Kelvin sign +// // See http://play.golang.org/p/tTxjOc0OGo // // The returned function is specialized for matching against s and diff --git a/vendor/github.com/ghodss/yaml/yaml.go b/vendor/github.com/ghodss/yaml/yaml.go index 4fb4054..70edc4b 100644 --- a/vendor/github.com/ghodss/yaml/yaml.go +++ b/vendor/github.com/ghodss/yaml/yaml.go @@ -64,12 +64,12 @@ func JSONToYAML(j []byte) ([]byte, error) { // this method should be a no-op. // // Things YAML can do that are not supported by JSON: -// * In YAML you can have binary and null keys in your maps. These are invalid -// in JSON. (int and float keys are converted to strings.) -// * Binary data in YAML with the !!binary tag is not supported. If you want to -// use binary data with this library, encode the data as base64 as usual but do -// not use the !!binary tag in your YAML. This will ensure the original base64 -// encoded data makes it all the way through to the JSON. +// - In YAML you can have binary and null keys in your maps. These are invalid +// in JSON. (int and float keys are converted to strings.) +// - Binary data in YAML with the !!binary tag is not supported. If you want to +// use binary data with this library, encode the data as base64 as usual but do +// not use the !!binary tag in your YAML. This will ensure the original base64 +// encoded data makes it all the way through to the JSON. func YAMLToJSON(y []byte) ([]byte, error) { return yamlToJSON(y, nil) } diff --git a/vendor/github.com/go-gorp/gorp/v3/db.go b/vendor/github.com/go-gorp/gorp/v3/db.go index d78062e..249ad6f 100644 --- a/vendor/github.com/go-gorp/gorp/v3/db.go +++ b/vendor/github.com/go-gorp/gorp/v3/db.go @@ -24,9 +24,8 @@ import ( // // Example: // -// dialect := gorp.MySQLDialect{"InnoDB", "UTF8"} -// dbmap := &gorp.DbMap{Db: db, Dialect: dialect} -// +// dialect := gorp.MySQLDialect{"InnoDB", "UTF8"} +// dbmap := &gorp.DbMap{Db: db, Dialect: dialect} type DbMap struct { ctx context.Context diff --git a/vendor/github.com/go-gorp/gorp/v3/dialect_snowflake.go b/vendor/github.com/go-gorp/gorp/v3/dialect_snowflake.go index 2e2cb89..6335e52 100644 --- a/vendor/github.com/go-gorp/gorp/v3/dialect_snowflake.go +++ b/vendor/github.com/go-gorp/gorp/v3/dialect_snowflake.go @@ -5,148 +5,148 @@ package gorp import ( - "fmt" - "reflect" - "strings" + "fmt" + "reflect" + "strings" ) type SnowflakeDialect struct { - suffix string - LowercaseFields bool + suffix string + LowercaseFields bool } func (d SnowflakeDialect) QuerySuffix() string { return ";" } func (d SnowflakeDialect) ToSqlType(val reflect.Type, maxsize int, isAutoIncr bool) string { - switch val.Kind() { - case reflect.Ptr: - return d.ToSqlType(val.Elem(), maxsize, isAutoIncr) - case reflect.Bool: - return "boolean" - case reflect.Int, - reflect.Int8, - reflect.Int16, - reflect.Int32, - reflect.Uint, - reflect.Uint8, - reflect.Uint16, - reflect.Uint32: + switch val.Kind() { + case reflect.Ptr: + return d.ToSqlType(val.Elem(), maxsize, isAutoIncr) + case reflect.Bool: + return "boolean" + case reflect.Int, + reflect.Int8, + reflect.Int16, + reflect.Int32, + reflect.Uint, + reflect.Uint8, + reflect.Uint16, + reflect.Uint32: - if isAutoIncr { - return "serial" - } - return "integer" - case reflect.Int64, reflect.Uint64: - if isAutoIncr { - return "bigserial" - } - return "bigint" - case reflect.Float64: - return "double precision" - case reflect.Float32: - return "real" - case reflect.Slice: - if val.Elem().Kind() == reflect.Uint8 { - return "binary" - } - } + if isAutoIncr { + return "serial" + } + return "integer" + case reflect.Int64, reflect.Uint64: + if isAutoIncr { + return "bigserial" + } + return "bigint" + case reflect.Float64: + return "double precision" + case reflect.Float32: + return "real" + case reflect.Slice: + if val.Elem().Kind() == reflect.Uint8 { + return "binary" + } + } - switch val.Name() { - case "NullInt64": - return "bigint" - case "NullFloat64": - return "double precision" - case "NullBool": - return "boolean" - case "Time", "NullTime": - return "timestamp with time zone" - } + switch val.Name() { + case "NullInt64": + return "bigint" + case "NullFloat64": + return "double precision" + case "NullBool": + return "boolean" + case "Time", "NullTime": + return "timestamp with time zone" + } - if maxsize > 0 { - return fmt.Sprintf("varchar(%d)", maxsize) - } else { - return "text" - } + if maxsize > 0 { + return fmt.Sprintf("varchar(%d)", maxsize) + } else { + return "text" + } } // Returns empty string func (d SnowflakeDialect) AutoIncrStr() string { - return "" + return "" } func (d SnowflakeDialect) AutoIncrBindValue() string { - return "default" + return "default" } func (d SnowflakeDialect) AutoIncrInsertSuffix(col *ColumnMap) string { - return "" + return "" } // Returns suffix func (d SnowflakeDialect) CreateTableSuffix() string { - return d.suffix + return d.suffix } func (d SnowflakeDialect) CreateIndexSuffix() string { - return "" + return "" } func (d SnowflakeDialect) DropIndexSuffix() string { - return "" + return "" } func (d SnowflakeDialect) TruncateClause() string { - return "truncate" + return "truncate" } // Returns "$(i+1)" func (d SnowflakeDialect) BindVar(i int) string { - return "?" + return "?" } func (d SnowflakeDialect) InsertAutoIncrToTarget(exec SqlExecutor, insertSql string, target interface{}, params ...interface{}) error { - rows, err := exec.Query(insertSql, params...) - if err != nil { - return err - } - defer rows.Close() + rows, err := exec.Query(insertSql, params...) + if err != nil { + return err + } + defer rows.Close() - if !rows.Next() { - return fmt.Errorf("No serial value returned for insert: %s Encountered error: %s", insertSql, rows.Err()) - } - if err := rows.Scan(target); err != nil { - return err - } - if rows.Next() { - return fmt.Errorf("more than two serial value returned for insert: %s", insertSql) - } - return rows.Err() + if !rows.Next() { + return fmt.Errorf("No serial value returned for insert: %s Encountered error: %s", insertSql, rows.Err()) + } + if err := rows.Scan(target); err != nil { + return err + } + if rows.Next() { + return fmt.Errorf("more than two serial value returned for insert: %s", insertSql) + } + return rows.Err() } func (d SnowflakeDialect) QuoteField(f string) string { - if d.LowercaseFields { - return `"` + strings.ToLower(f) + `"` - } - return `"` + f + `"` + if d.LowercaseFields { + return `"` + strings.ToLower(f) + `"` + } + return `"` + f + `"` } func (d SnowflakeDialect) QuotedTableForQuery(schema string, table string) string { - if strings.TrimSpace(schema) == "" { - return d.QuoteField(table) - } + if strings.TrimSpace(schema) == "" { + return d.QuoteField(table) + } - return schema + "." + d.QuoteField(table) + return schema + "." + d.QuoteField(table) } func (d SnowflakeDialect) IfSchemaNotExists(command, schema string) string { - return fmt.Sprintf("%s if not exists", command) + return fmt.Sprintf("%s if not exists", command) } func (d SnowflakeDialect) IfTableExists(command, schema, table string) string { - return fmt.Sprintf("%s if exists", command) + return fmt.Sprintf("%s if exists", command) } func (d SnowflakeDialect) IfTableNotExists(command, schema, table string) string { - return fmt.Sprintf("%s if not exists", command) + return fmt.Sprintf("%s if not exists", command) } diff --git a/vendor/github.com/go-gorp/gorp/v3/select.go b/vendor/github.com/go-gorp/gorp/v3/select.go index 2d2d596..4b89641 100644 --- a/vendor/github.com/go-gorp/gorp/v3/select.go +++ b/vendor/github.com/go-gorp/gorp/v3/select.go @@ -86,10 +86,9 @@ func SelectNullStr(e SqlExecutor, query string, args ...interface{}) (sql.NullSt // SelectOne executes the given query (which should be a SELECT statement) // and binds the result to holder, which must be a pointer. // -// If no row is found, an error (sql.ErrNoRows specifically) will be returned +// # If no row is found, an error (sql.ErrNoRows specifically) will be returned // // If more than one row is found, an error will be returned. -// func SelectOne(m *DbMap, e SqlExecutor, holder interface{}, query string, args ...interface{}) error { t := reflect.TypeOf(holder) if t.Kind() == reflect.Ptr { diff --git a/vendor/github.com/go-gorp/gorp/v3/table.go b/vendor/github.com/go-gorp/gorp/v3/table.go index 5931b2d..edab08a 100644 --- a/vendor/github.com/go-gorp/gorp/v3/table.go +++ b/vendor/github.com/go-gorp/gorp/v3/table.go @@ -47,7 +47,6 @@ func (t *TableMap) ResetSql() { // Automatically calls ResetSql() to ensure SQL statements are regenerated. // // Panics if isAutoIncr is true, and fieldNames length != 1 -// func (t *TableMap) SetKeys(isAutoIncr bool, fieldNames ...string) *TableMap { if isAutoIncr && len(fieldNames) != 1 { panic(fmt.Sprintf( @@ -73,7 +72,6 @@ func (t *TableMap) SetKeys(isAutoIncr bool, fieldNames ...string) *TableMap { // Automatically calls ResetSql() to ensure SQL statements are regenerated. // // Panics if fieldNames length < 2. -// func (t *TableMap) SetUniqueTogether(fieldNames ...string) *TableMap { if len(fieldNames) < 2 { panic(fmt.Sprintf( @@ -135,7 +133,6 @@ func (t *TableMap) IdxMap(field string) *IndexMap { // Function will panic if one of the given for index columns does not exists // // Automatically calls ResetSql() to ensure SQL statements are regenerated. -// func (t *TableMap) AddIndex(name string, idxtype string, columns []string) *IndexMap { // check if we have a index with this name already for _, idx := range t.indexes { diff --git a/vendor/github.com/go-ozzo/ozzo-validation/date.go b/vendor/github.com/go-ozzo/ozzo-validation/date.go index 432e035..9ba71fb 100644 --- a/vendor/github.com/go-ozzo/ozzo-validation/date.go +++ b/vendor/github.com/go-ozzo/ozzo-validation/date.go @@ -19,9 +19,10 @@ type DateRule struct { // Date returns a validation rule that checks if a string value is in a format that can be parsed into a date. // The format of the date should be specified as the layout parameter which accepts the same value as that for time.Parse. // For example, -// validation.Date(time.ANSIC) -// validation.Date("02 Jan 06 15:04 MST") -// validation.Date("2006-01-02") +// +// validation.Date(time.ANSIC) +// validation.Date("02 Jan 06 15:04 MST") +// validation.Date("2006-01-02") // // By calling Min() and/or Max(), you can let the Date rule to check if a parsed date value is within // the specified date range. diff --git a/vendor/github.com/go-ozzo/ozzo-validation/multipleof.go b/vendor/github.com/go-ozzo/ozzo-validation/multipleof.go index c40fcfa..da3ed94 100644 --- a/vendor/github.com/go-ozzo/ozzo-validation/multipleof.go +++ b/vendor/github.com/go-ozzo/ozzo-validation/multipleof.go @@ -24,7 +24,6 @@ func (r *multipleOfRule) Error(message string) *multipleOfRule { return r } - func (r *multipleOfRule) Validate(value interface{}) error { rv := reflect.ValueOf(r.threshold) diff --git a/vendor/github.com/go-ozzo/ozzo-validation/struct.go b/vendor/github.com/go-ozzo/ozzo-validation/struct.go index 2ff852a..d380029 100644 --- a/vendor/github.com/go-ozzo/ozzo-validation/struct.go +++ b/vendor/github.com/go-ozzo/ozzo-validation/struct.go @@ -46,16 +46,16 @@ func (e ErrFieldNotFound) Error() string { // should be specified as a pointer to the field. A field can be associated with multiple rules. // For example, // -// value := struct { -// Name string -// Value string -// }{"name", "demo"} -// err := validation.ValidateStruct(&value, -// validation.Field(&a.Name, validation.Required), -// validation.Field(&a.Value, validation.Required, validation.Length(5, 10)), -// ) -// fmt.Println(err) -// // Value: the length must be between 5 and 10. +// value := struct { +// Name string +// Value string +// }{"name", "demo"} +// err := validation.ValidateStruct(&value, +// validation.Field(&a.Name, validation.Required), +// validation.Field(&a.Value, validation.Required, validation.Length(5, 10)), +// ) +// fmt.Println(err) +// // Value: the length must be between 5 and 10. // // An error will be returned if validation fails. func ValidateStruct(structPtr interface{}, fields ...*FieldRules) error { diff --git a/vendor/github.com/go-ozzo/ozzo-validation/v4/map.go b/vendor/github.com/go-ozzo/ozzo-validation/v4/map.go index 106b6d8..b3a87bd 100644 --- a/vendor/github.com/go-ozzo/ozzo-validation/v4/map.go +++ b/vendor/github.com/go-ozzo/ozzo-validation/v4/map.go @@ -41,10 +41,11 @@ type ( // Use Key() to specify map keys that need to be validated. Each Key() call specifies a single key which can // be associated with multiple rules. // For example, -// validation.Map( -// validation.Key("Name", validation.Required), -// validation.Key("Value", validation.Required, validation.Length(5, 10)), -// ) +// +// validation.Map( +// validation.Key("Name", validation.Required), +// validation.Key("Value", validation.Required, validation.Length(5, 10)), +// ) // // A nil value is considered valid. Use the Required rule to make sure a map value is present. func Map(keys ...*KeyRules) MapRule { diff --git a/vendor/github.com/go-ozzo/ozzo-validation/v4/struct.go b/vendor/github.com/go-ozzo/ozzo-validation/v4/struct.go index d63619d..08b63ba 100644 --- a/vendor/github.com/go-ozzo/ozzo-validation/v4/struct.go +++ b/vendor/github.com/go-ozzo/ozzo-validation/v4/struct.go @@ -47,16 +47,16 @@ func (e ErrFieldNotFound) Error() string { // should be specified as a pointer to the field. A field can be associated with multiple rules. // For example, // -// value := struct { -// Name string -// Value string -// }{"name", "demo"} -// err := validation.ValidateStruct(&value, -// validation.Field(&a.Name, validation.Required), -// validation.Field(&a.Value, validation.Required, validation.Length(5, 10)), -// ) -// fmt.Println(err) -// // Value: the length must be between 5 and 10. +// value := struct { +// Name string +// Value string +// }{"name", "demo"} +// err := validation.ValidateStruct(&value, +// validation.Field(&a.Name, validation.Required), +// validation.Field(&a.Value, validation.Required, validation.Length(5, 10)), +// ) +// fmt.Println(err) +// // Value: the length must be between 5 and 10. // // An error will be returned if validation fails. func ValidateStruct(structPtr interface{}, fields ...*FieldRules) error { diff --git a/vendor/github.com/go-ozzo/ozzo-validation/v4/validation.go b/vendor/github.com/go-ozzo/ozzo-validation/v4/validation.go index ec7a161..0495f32 100644 --- a/vendor/github.com/go-ozzo/ozzo-validation/v4/validation.go +++ b/vendor/github.com/go-ozzo/ozzo-validation/v4/validation.go @@ -60,11 +60,11 @@ var ( // Validate validates the given value and returns the validation error, if any. // // Validate performs validation using the following steps: -// 1. For each rule, call its `Validate()` to validate the value. Return if any error is found. -// 2. If the value being validated implements `Validatable`, call the value's `Validate()`. -// Return with the validation result. -// 3. If the value being validated is a map/slice/array, and the element type implements `Validatable`, -// for each element call the element value's `Validate()`. Return with the validation result. +// 1. For each rule, call its `Validate()` to validate the value. Return if any error is found. +// 2. If the value being validated implements `Validatable`, call the value's `Validate()`. +// Return with the validation result. +// 3. If the value being validated is a map/slice/array, and the element type implements `Validatable`, +// for each element call the element value's `Validate()`. Return with the validation result. func Validate(value interface{}, rules ...Rule) error { for _, rule := range rules { if s, ok := rule.(skipRule); ok && s.skip { @@ -103,16 +103,16 @@ func Validate(value interface{}, rules ...Rule) error { // ValidateWithContext validates the given value with the given context and returns the validation error, if any. // // ValidateWithContext performs validation using the following steps: -// 1. For each rule, call its `ValidateWithContext()` to validate the value if the rule implements `RuleWithContext`. -// Otherwise call `Validate()` of the rule. Return if any error is found. -// 2. If the value being validated implements `ValidatableWithContext`, call the value's `ValidateWithContext()` -// and return with the validation result. -// 3. If the value being validated implements `Validatable`, call the value's `Validate()` -// and return with the validation result. -// 4. If the value being validated is a map/slice/array, and the element type implements `ValidatableWithContext`, -// for each element call the element value's `ValidateWithContext()`. Return with the validation result. -// 5. If the value being validated is a map/slice/array, and the element type implements `Validatable`, -// for each element call the element value's `Validate()`. Return with the validation result. +// 1. For each rule, call its `ValidateWithContext()` to validate the value if the rule implements `RuleWithContext`. +// Otherwise call `Validate()` of the rule. Return if any error is found. +// 2. If the value being validated implements `ValidatableWithContext`, call the value's `ValidateWithContext()` +// and return with the validation result. +// 3. If the value being validated implements `Validatable`, call the value's `Validate()` +// and return with the validation result. +// 4. If the value being validated is a map/slice/array, and the element type implements `ValidatableWithContext`, +// for each element call the element value's `ValidateWithContext()`. Return with the validation result. +// 5. If the value being validated is a map/slice/array, and the element type implements `Validatable`, +// for each element call the element value's `Validate()`. Return with the validation result. func ValidateWithContext(ctx context.Context, value interface{}, rules ...Rule) error { for _, rule := range rules { if s, ok := rule.(skipRule); ok && s.skip { diff --git a/vendor/github.com/go-sql-driver/mysql/auth.go b/vendor/github.com/go-sql-driver/mysql/auth.go index b2f19e8..d1371a4 100644 --- a/vendor/github.com/go-sql-driver/mysql/auth.go +++ b/vendor/github.com/go-sql-driver/mysql/auth.go @@ -33,27 +33,26 @@ var ( // Note: The provided rsa.PublicKey instance is exclusively owned by the driver // after registering it and may not be modified. // -// data, err := ioutil.ReadFile("mykey.pem") -// if err != nil { -// log.Fatal(err) -// } +// data, err := ioutil.ReadFile("mykey.pem") +// if err != nil { +// log.Fatal(err) +// } // -// block, _ := pem.Decode(data) -// if block == nil || block.Type != "PUBLIC KEY" { -// log.Fatal("failed to decode PEM block containing public key") -// } +// block, _ := pem.Decode(data) +// if block == nil || block.Type != "PUBLIC KEY" { +// log.Fatal("failed to decode PEM block containing public key") +// } // -// pub, err := x509.ParsePKIXPublicKey(block.Bytes) -// if err != nil { -// log.Fatal(err) -// } -// -// if rsaPubKey, ok := pub.(*rsa.PublicKey); ok { -// mysql.RegisterServerPubKey("mykey", rsaPubKey) -// } else { -// log.Fatal("not a RSA public key") -// } +// pub, err := x509.ParsePKIXPublicKey(block.Bytes) +// if err != nil { +// log.Fatal(err) +// } // +// if rsaPubKey, ok := pub.(*rsa.PublicKey); ok { +// mysql.RegisterServerPubKey("mykey", rsaPubKey) +// } else { +// log.Fatal("not a RSA public key") +// } func RegisterServerPubKey(name string, pubKey *rsa.PublicKey) { serverPubKeyLock.Lock() if serverPubKeyRegistry == nil { diff --git a/vendor/github.com/go-sql-driver/mysql/conncheck.go b/vendor/github.com/go-sql-driver/mysql/conncheck.go index 024eb28..0ea7217 100644 --- a/vendor/github.com/go-sql-driver/mysql/conncheck.go +++ b/vendor/github.com/go-sql-driver/mysql/conncheck.go @@ -6,6 +6,7 @@ // License, v. 2.0. If a copy of the MPL was not distributed with this file, // You can obtain one at http://mozilla.org/MPL/2.0/. +//go:build linux || darwin || dragonfly || freebsd || netbsd || openbsd || solaris || illumos // +build linux darwin dragonfly freebsd netbsd openbsd solaris illumos package mysql diff --git a/vendor/github.com/go-sql-driver/mysql/driver.go b/vendor/github.com/go-sql-driver/mysql/driver.go index c1bdf11..ad7aec2 100644 --- a/vendor/github.com/go-sql-driver/mysql/driver.go +++ b/vendor/github.com/go-sql-driver/mysql/driver.go @@ -8,10 +8,10 @@ // // The driver should be used via the database/sql package: // -// import "database/sql" -// import _ "github.com/go-sql-driver/mysql" +// import "database/sql" +// import _ "github.com/go-sql-driver/mysql" // -// db, err := sql.Open("mysql", "user:password@/dbname") +// db, err := sql.Open("mysql", "user:password@/dbname") // // See https://github.com/go-sql-driver/mysql#usage for details package mysql diff --git a/vendor/github.com/go-sql-driver/mysql/infile.go b/vendor/github.com/go-sql-driver/mysql/infile.go index 60effdf..955a00a 100644 --- a/vendor/github.com/go-sql-driver/mysql/infile.go +++ b/vendor/github.com/go-sql-driver/mysql/infile.go @@ -28,12 +28,11 @@ var ( // Alternatively you can allow the use of all local files with // the DSN parameter 'allowAllFiles=true' // -// filePath := "/home/gopher/data.csv" -// mysql.RegisterLocalFile(filePath) -// err := db.Exec("LOAD DATA LOCAL INFILE '" + filePath + "' INTO TABLE foo") -// if err != nil { -// ... -// +// filePath := "/home/gopher/data.csv" +// mysql.RegisterLocalFile(filePath) +// err := db.Exec("LOAD DATA LOCAL INFILE '" + filePath + "' INTO TABLE foo") +// if err != nil { +// ... func RegisterLocalFile(filePath string) { fileRegisterLock.Lock() // lazy map init @@ -58,15 +57,14 @@ func DeregisterLocalFile(filePath string) { // If the handler returns a io.ReadCloser Close() is called when the // request is finished. // -// mysql.RegisterReaderHandler("data", func() io.Reader { -// var csvReader io.Reader // Some Reader that returns CSV data -// ... // Open Reader here -// return csvReader -// }) -// err := db.Exec("LOAD DATA LOCAL INFILE 'Reader::data' INTO TABLE foo") -// if err != nil { -// ... -// +// mysql.RegisterReaderHandler("data", func() io.Reader { +// var csvReader io.Reader // Some Reader that returns CSV data +// ... // Open Reader here +// return csvReader +// }) +// err := db.Exec("LOAD DATA LOCAL INFILE 'Reader::data' INTO TABLE foo") +// if err != nil { +// ... func RegisterReaderHandler(name string, handler func() io.Reader) { readerRegisterLock.Lock() // lazy map init diff --git a/vendor/github.com/go-sql-driver/mysql/utils.go b/vendor/github.com/go-sql-driver/mysql/utils.go index d6545f5..ae7be39 100644 --- a/vendor/github.com/go-sql-driver/mysql/utils.go +++ b/vendor/github.com/go-sql-driver/mysql/utils.go @@ -35,26 +35,25 @@ var ( // Note: The provided tls.Config is exclusively owned by the driver after // registering it. // -// rootCertPool := x509.NewCertPool() -// pem, err := ioutil.ReadFile("/path/ca-cert.pem") -// if err != nil { -// log.Fatal(err) -// } -// if ok := rootCertPool.AppendCertsFromPEM(pem); !ok { -// log.Fatal("Failed to append PEM.") -// } -// clientCert := make([]tls.Certificate, 0, 1) -// certs, err := tls.LoadX509KeyPair("/path/client-cert.pem", "/path/client-key.pem") -// if err != nil { -// log.Fatal(err) -// } -// clientCert = append(clientCert, certs) -// mysql.RegisterTLSConfig("custom", &tls.Config{ -// RootCAs: rootCertPool, -// Certificates: clientCert, -// }) -// db, err := sql.Open("mysql", "user@tcp(localhost:3306)/test?tls=custom") -// +// rootCertPool := x509.NewCertPool() +// pem, err := ioutil.ReadFile("/path/ca-cert.pem") +// if err != nil { +// log.Fatal(err) +// } +// if ok := rootCertPool.AppendCertsFromPEM(pem); !ok { +// log.Fatal("Failed to append PEM.") +// } +// clientCert := make([]tls.Certificate, 0, 1) +// certs, err := tls.LoadX509KeyPair("/path/client-cert.pem", "/path/client-key.pem") +// if err != nil { +// log.Fatal(err) +// } +// clientCert = append(clientCert, certs) +// mysql.RegisterTLSConfig("custom", &tls.Config{ +// RootCAs: rootCertPool, +// Certificates: clientCert, +// }) +// db, err := sql.Open("mysql", "user@tcp(localhost:3306)/test?tls=custom") func RegisterTLSConfig(key string, config *tls.Config) error { if _, isBool := readBool(key); isBool || strings.ToLower(key) == "skip-verify" || strings.ToLower(key) == "preferred" { return fmt.Errorf("key '%s' is reserved", key) diff --git a/vendor/github.com/golang-jwt/jwt/ed25519.go b/vendor/github.com/golang-jwt/jwt/ed25519.go index a2f8ddb..9c18f05 100644 --- a/vendor/github.com/golang-jwt/jwt/ed25519.go +++ b/vendor/github.com/golang-jwt/jwt/ed25519.go @@ -1,9 +1,8 @@ package jwt import ( - "errors" - "crypto/ed25519" + "errors" ) var ( diff --git a/vendor/github.com/golang-jwt/jwt/map_claims.go b/vendor/github.com/golang-jwt/jwt/map_claims.go index 72c79f9..9fa1454 100644 --- a/vendor/github.com/golang-jwt/jwt/map_claims.go +++ b/vendor/github.com/golang-jwt/jwt/map_claims.go @@ -3,7 +3,6 @@ package jwt import ( "encoding/json" "errors" - // "fmt" ) // Claims type that uses the map[string]interface{} for JSON decoding diff --git a/vendor/github.com/golang-jwt/jwt/rsa_pss.go b/vendor/github.com/golang-jwt/jwt/rsa_pss.go index c014708..370c5a8 100644 --- a/vendor/github.com/golang-jwt/jwt/rsa_pss.go +++ b/vendor/github.com/golang-jwt/jwt/rsa_pss.go @@ -1,3 +1,4 @@ +//go:build go1.4 // +build go1.4 package jwt diff --git a/vendor/github.com/golang-jwt/jwt/v4/ed25519.go b/vendor/github.com/golang-jwt/jwt/v4/ed25519.go index 07d3aac..24bd027 100644 --- a/vendor/github.com/golang-jwt/jwt/v4/ed25519.go +++ b/vendor/github.com/golang-jwt/jwt/v4/ed25519.go @@ -1,11 +1,10 @@ package jwt import ( - "errors" - "crypto" "crypto/ed25519" "crypto/rand" + "errors" ) var ( diff --git a/vendor/github.com/golang-jwt/jwt/v4/map_claims.go b/vendor/github.com/golang-jwt/jwt/v4/map_claims.go index 2700d64..1d5c430 100644 --- a/vendor/github.com/golang-jwt/jwt/v4/map_claims.go +++ b/vendor/github.com/golang-jwt/jwt/v4/map_claims.go @@ -4,7 +4,6 @@ import ( "encoding/json" "errors" "time" - // "fmt" ) // MapClaims is a claims type that uses the map[string]interface{} for JSON decoding. diff --git a/vendor/github.com/golang-jwt/jwt/v5/ed25519.go b/vendor/github.com/golang-jwt/jwt/v5/ed25519.go index 3db00e4..eb6bdf0 100644 --- a/vendor/github.com/golang-jwt/jwt/v5/ed25519.go +++ b/vendor/github.com/golang-jwt/jwt/v5/ed25519.go @@ -1,11 +1,10 @@ package jwt import ( - "errors" - "crypto" "crypto/ed25519" "crypto/rand" + "errors" ) var ( diff --git a/vendor/github.com/kavenegar/kavenegar-go/message_countInbox.go b/vendor/github.com/kavenegar/kavenegar-go/message_countInbox.go index 1508b58..54159b8 100644 --- a/vendor/github.com/kavenegar/kavenegar-go/message_countInbox.go +++ b/vendor/github.com/kavenegar/kavenegar-go/message_countInbox.go @@ -5,20 +5,20 @@ import ( "time" ) -//MessageCountInbox ... +// MessageCountInbox ... type MessageCountInbox struct { Startdate int `json:"startdate"` Enddate int `json:"enddate"` Sumcount int `json:"sumcount"` } -//MessageCountInboxResult ... +// MessageCountInboxResult ... type MessageCountInboxResult struct { *Return `json:"return"` Entries []MessageCountInbox `json:"entries"` } -//CountInbox ... +// CountInbox ... func (message *MessageService) CountInbox(linenumber string, startdate time.Time, endate time.Time, isread bool) (MessageCountInbox, error) { v := url.Values{} @@ -33,13 +33,13 @@ func (message *MessageService) CountInbox(linenumber string, startdate time.Time return message.CreateCountInbox(v) } -//CreateCountInbox ... +// CreateCountInbox ... func (message *MessageService) CreateCountInbox(v url.Values) (MessageCountInbox, error) { u := message.client.EndPoint("sms", "countinbox") m := new(MessageCountInboxResult) err := message.client.Execute(u.String(), v, m) - if m.Entries==nil{ - return MessageCountInbox{},err + if m.Entries == nil { + return MessageCountInbox{}, err } return m.Entries[0], err -} \ No newline at end of file +} diff --git a/vendor/github.com/kavenegar/kavenegar-go/message_countPostalCode.go b/vendor/github.com/kavenegar/kavenegar-go/message_countPostalCode.go index 86d5661..c768fcc 100644 --- a/vendor/github.com/kavenegar/kavenegar-go/message_countPostalCode.go +++ b/vendor/github.com/kavenegar/kavenegar-go/message_countPostalCode.go @@ -5,19 +5,19 @@ import ( "strconv" ) -//MessageCountPostalCode ... +// MessageCountPostalCode ... type MessageCountPostalCode struct { Section string `json:"section"` Value int `json:"value"` } -//MessageCountPostalCodeResult ... +// MessageCountPostalCodeResult ... type MessageCountPostalCodeResult struct { *Return `json:"return"` Entries []MessageCountPostalCode `json:"entries"` } -//CountPostalCode ... +// CountPostalCode ... func (message *MessageService) CountPostalCode(postalcode int64) ([]MessageCountPostalCode, error) { u := message.client.EndPoint("sms", "countpostalcode") m := new(MessageCountPostalCodeResult) diff --git a/vendor/github.com/kavenegar/kavenegar-go/message_countoutbox.go b/vendor/github.com/kavenegar/kavenegar-go/message_countoutbox.go index 7ea8369..cbe3988 100644 --- a/vendor/github.com/kavenegar/kavenegar-go/message_countoutbox.go +++ b/vendor/github.com/kavenegar/kavenegar-go/message_countoutbox.go @@ -5,20 +5,20 @@ import ( "time" ) -//MessageCountOutbox ... +// MessageCountOutbox ... type MessageCountOutbox struct { *MessageCountInbox Sumpart int `json:"sumpart"` Cost int `json:"cost"` } -//MessageCountOutboxResult ... +// MessageCountOutboxResult ... type MessageCountOutboxResult struct { *Return `json:"return"` Entries []MessageCountOutbox `json:"entries"` } -//CountOutbox ... +// CountOutbox ... func (message *MessageService) CountOutbox(startdate time.Time, endate time.Time, status MessageStatusType) (MessageCountOutbox, error) { v := url.Values{} v.Set("startdate", ToUnix(startdate)) @@ -29,13 +29,13 @@ func (message *MessageService) CountOutbox(startdate time.Time, endate time.Time return message.CreateCountOutbox(v) } -//CreateCountOutbox ... +// CreateCountOutbox ... func (message *MessageService) CreateCountOutbox(v url.Values) (MessageCountOutbox, error) { u := message.client.EndPoint("sms", "countoutbox") m := new(MessageCountOutboxResult) err := message.client.Execute(u.String(), v, m) - if m.Entries==nil{ - return MessageCountOutbox{},err + if m.Entries == nil { + return MessageCountOutbox{}, err } return m.Entries[0], err } diff --git a/vendor/github.com/kavenegar/kavenegar-go/message_latestOutbox.go b/vendor/github.com/kavenegar/kavenegar-go/message_latestOutbox.go index a09bb00..35ec68e 100644 --- a/vendor/github.com/kavenegar/kavenegar-go/message_latestOutbox.go +++ b/vendor/github.com/kavenegar/kavenegar-go/message_latestOutbox.go @@ -5,7 +5,7 @@ import ( "strconv" ) -//LatestOutbox ... +// LatestOutbox ... func (message *MessageService) LatestOutbox(sender string, pagesize int) ([]Message, error) { v := url.Values{} v.Set("sender", sender) @@ -13,7 +13,7 @@ func (message *MessageService) LatestOutbox(sender string, pagesize int) ([]Mess return message.CreateLatestOutbox(v) } -//CreateLatestOutbox ... +// CreateLatestOutbox ... func (message *MessageService) CreateLatestOutbox(v url.Values) ([]Message, error) { u := message.client.EndPoint("sms", "latestoutbox") vc := url.Values{} diff --git a/vendor/github.com/kavenegar/kavenegar-go/message_selectOutbox.go b/vendor/github.com/kavenegar/kavenegar-go/message_selectOutbox.go index 5de5711..766765c 100644 --- a/vendor/github.com/kavenegar/kavenegar-go/message_selectOutbox.go +++ b/vendor/github.com/kavenegar/kavenegar-go/message_selectOutbox.go @@ -5,7 +5,7 @@ import ( "time" ) -//SelectOutbox ... +// SelectOutbox ... func (message *MessageService) SelectOutbox(startdate time.Time, endate time.Time, sender string) ([]Message, error) { v := url.Values{} @@ -23,7 +23,7 @@ func (message *MessageService) SelectOutbox(startdate time.Time, endate time.Tim return message.CreateSelectOutbox(v) } -//CreateSelectOutbox ... +// CreateSelectOutbox ... func (message *MessageService) CreateSelectOutbox(v url.Values) ([]Message, error) { u := message.client.EndPoint("sms", "selectoutbox") m := new(MessageResult) diff --git a/vendor/github.com/kavenegar/kavenegar-go/message_sendByPostalCode.go b/vendor/github.com/kavenegar/kavenegar-go/message_sendByPostalCode.go index 0817c77..fe537b2 100644 --- a/vendor/github.com/kavenegar/kavenegar-go/message_sendByPostalCode.go +++ b/vendor/github.com/kavenegar/kavenegar-go/message_sendByPostalCode.go @@ -6,7 +6,7 @@ import ( "time" ) -//SendPostalCode ... +// SendPostalCode ... func (m *MessageService) SendPostalCode(postalcode int64, sender string, message string, mcistartindex int, mcicount int, mtnstartindex int, mtncount int, date time.Time) ([]Message, error) { v := url.Values{} v.Set("postalcode", strconv.FormatInt(postalcode, 10)) @@ -20,9 +20,9 @@ func (m *MessageService) SendPostalCode(postalcode int64, sender string, message return m.CreateSendPostalCode(v) } -//CreateSendPostalCode ... +// CreateSendPostalCode ... func (m *MessageService) CreateSendPostalCode(v url.Values) ([]Message, error) { - u := m.client.EndPoint("sms", "sendbypostalcode") + u := m.client.EndPoint("sms", "sendbypostalcode") res := new(MessageResult) err := m.client.Execute(u.String(), v, res) return res.Entries, err diff --git a/vendor/github.com/kavenegar/kavenegar-go/message_statusLocal.go b/vendor/github.com/kavenegar/kavenegar-go/message_statusLocal.go index b66d18f..2b060e9 100644 --- a/vendor/github.com/kavenegar/kavenegar-go/message_statusLocal.go +++ b/vendor/github.com/kavenegar/kavenegar-go/message_statusLocal.go @@ -5,26 +5,26 @@ import ( "strconv" ) -//MessageStatusLocal ... +// MessageStatusLocal ... type MessageStatusLocal struct { *MessageStatus LocalID string `json:"localid"` } -//MessageStatusLocalResult ... +// MessageStatusLocalResult ... type MessageStatusLocalResult struct { *Return `json:"return"` Entries []MessageStatusLocal `json:"entries"` } -//StatusLocal ... +// StatusLocal ... func (message *MessageService) StatusLocal(localid int64) (MessageStatusLocal, error) { u := message.client.EndPoint("sms", "statuslocalmessageid") m := new(MessageStatusLocalResult) v := url.Values{} v.Set("localid", strconv.FormatInt(localid, 10)) err := message.client.Execute(u.String(), v, m) - if err!=nil{ + if err != nil { return MessageStatusLocal{}, err } return m.Entries[0], err diff --git a/vendor/github.com/kavenegar/kavenegar-go/utils.go b/vendor/github.com/kavenegar/kavenegar-go/utils.go index a7bcbde..28e96f2 100644 --- a/vendor/github.com/kavenegar/kavenegar-go/utils.go +++ b/vendor/github.com/kavenegar/kavenegar-go/utils.go @@ -10,23 +10,23 @@ import ( "time" ) -//ToString ... +// ToString ... func ToString(i interface{}) string { return strings.Trim(strings.Replace(fmt.Sprint(i), " ", ",", -1), "[]") } -//ToJson ... +// ToJson ... func ToJson(i interface{}) string { _json, _ := json.Marshal(i) return string(_json) } -//ToUnix ... +// ToUnix ... func ToUnix(t time.Time) string { return strconv.FormatInt(t.Unix(), 10) } -//structToUrlValues ... +// structToUrlValues ... func structToURLValues(i interface{}) url.Values { v := url.Values{} if reflect.ValueOf(i).IsNil() { diff --git a/vendor/github.com/knadh/koanf/maps/maps.go b/vendor/github.com/knadh/koanf/maps/maps.go index ff95608..cad1068 100644 --- a/vendor/github.com/knadh/koanf/maps/maps.go +++ b/vendor/github.com/knadh/koanf/maps/maps.go @@ -5,9 +5,10 @@ package maps import ( "fmt" - "github.com/mitchellh/copystructure" "reflect" "strings" + + "github.com/mitchellh/copystructure" ) // Flatten takes a map[string]interface{} and traverses it and flattens diff --git a/vendor/github.com/knadh/koanf/providers/structs/structs.go b/vendor/github.com/knadh/koanf/providers/structs/structs.go index 0022083..7508b62 100644 --- a/vendor/github.com/knadh/koanf/providers/structs/structs.go +++ b/vendor/github.com/knadh/koanf/providers/structs/structs.go @@ -6,7 +6,6 @@ import ( "errors" "github.com/fatih/structs" - "github.com/knadh/koanf/maps" ) diff --git a/vendor/github.com/labstack/echo-jwt/v4/extractors.go b/vendor/github.com/labstack/echo-jwt/v4/extractors.go index f72537e..d21f53c 100644 --- a/vendor/github.com/labstack/echo-jwt/v4/extractors.go +++ b/vendor/github.com/labstack/echo-jwt/v4/extractors.go @@ -6,10 +6,11 @@ package echojwt import ( "errors" "fmt" - "github.com/labstack/echo/v4" - "github.com/labstack/echo/v4/middleware" "net/textproto" "strings" + + "github.com/labstack/echo/v4" + "github.com/labstack/echo/v4/middleware" ) const ( diff --git a/vendor/github.com/labstack/echo/v4/log.go b/vendor/github.com/labstack/echo/v4/log.go index 0acd9ff..96276ae 100644 --- a/vendor/github.com/labstack/echo/v4/log.go +++ b/vendor/github.com/labstack/echo/v4/log.go @@ -4,8 +4,9 @@ package echo import ( - "github.com/labstack/gommon/log" "io" + + "github.com/labstack/gommon/log" ) // Logger defines the logging interface. diff --git a/vendor/github.com/labstack/echo/v4/middleware/extractor.go b/vendor/github.com/labstack/echo/v4/middleware/extractor.go index 3f27414..a5eb4b2 100644 --- a/vendor/github.com/labstack/echo/v4/middleware/extractor.go +++ b/vendor/github.com/labstack/echo/v4/middleware/extractor.go @@ -6,9 +6,10 @@ package middleware import ( "errors" "fmt" - "github.com/labstack/echo/v4" "net/textproto" "strings" + + "github.com/labstack/echo/v4" ) const ( diff --git a/vendor/github.com/labstack/echo/v4/middleware/jwt.go b/vendor/github.com/labstack/echo/v4/middleware/jwt.go index a6bf16f..65de9d3 100644 --- a/vendor/github.com/labstack/echo/v4/middleware/jwt.go +++ b/vendor/github.com/labstack/echo/v4/middleware/jwt.go @@ -9,10 +9,11 @@ package middleware import ( "errors" "fmt" - "github.com/golang-jwt/jwt" - "github.com/labstack/echo/v4" "net/http" "reflect" + + "github.com/golang-jwt/jwt" + "github.com/labstack/echo/v4" ) // JWTConfig defines the config for JWT middleware. diff --git a/vendor/github.com/labstack/echo/v4/middleware/key_auth.go b/vendor/github.com/labstack/echo/v4/middleware/key_auth.go index 79bee20..66ada83 100644 --- a/vendor/github.com/labstack/echo/v4/middleware/key_auth.go +++ b/vendor/github.com/labstack/echo/v4/middleware/key_auth.go @@ -5,8 +5,9 @@ package middleware import ( "errors" - "github.com/labstack/echo/v4" "net/http" + + "github.com/labstack/echo/v4" ) // KeyAuthConfig defines the config for KeyAuth middleware. diff --git a/vendor/github.com/labstack/echo/v4/middleware/timeout.go b/vendor/github.com/labstack/echo/v4/middleware/timeout.go index c2aebef..e593764 100644 --- a/vendor/github.com/labstack/echo/v4/middleware/timeout.go +++ b/vendor/github.com/labstack/echo/v4/middleware/timeout.go @@ -5,10 +5,11 @@ package middleware import ( "context" - "github.com/labstack/echo/v4" "net/http" "sync" "time" + + "github.com/labstack/echo/v4" ) // --------------------------------------------------------------------------------------------------------------- diff --git a/vendor/github.com/labstack/gommon/log/color.go b/vendor/github.com/labstack/gommon/log/color.go index 7351b39..84fa274 100644 --- a/vendor/github.com/labstack/gommon/log/color.go +++ b/vendor/github.com/labstack/gommon/log/color.go @@ -1,3 +1,4 @@ +//go:build !appengine // +build !appengine package log diff --git a/vendor/github.com/labstack/gommon/log/log.go b/vendor/github.com/labstack/gommon/log/log.go index 25f719a..e840be3 100644 --- a/vendor/github.com/labstack/gommon/log/log.go +++ b/vendor/github.com/labstack/gommon/log/log.go @@ -13,10 +13,9 @@ import ( "sync/atomic" "time" + "github.com/labstack/gommon/color" "github.com/mattn/go-isatty" "github.com/valyala/fasttemplate" - - "github.com/labstack/gommon/color" ) type ( diff --git a/vendor/github.com/labstack/gommon/log/white.go b/vendor/github.com/labstack/gommon/log/white.go index 746cc56..cf0c27c 100644 --- a/vendor/github.com/labstack/gommon/log/white.go +++ b/vendor/github.com/labstack/gommon/log/white.go @@ -1,3 +1,4 @@ +//go:build appengine // +build appengine package log diff --git a/vendor/github.com/mailru/easyjson/jlexer/bytestostr.go b/vendor/github.com/mailru/easyjson/jlexer/bytestostr.go index ff7b27c..87f7fb7 100644 --- a/vendor/github.com/mailru/easyjson/jlexer/bytestostr.go +++ b/vendor/github.com/mailru/easyjson/jlexer/bytestostr.go @@ -2,8 +2,8 @@ // easyjson_nounsafe nor appengine build tag is set. See README notes // for more details. -//+build !easyjson_nounsafe -//+build !appengine +//go:build !easyjson_nounsafe && !appengine +// +build !easyjson_nounsafe,!appengine package jlexer diff --git a/vendor/github.com/mattn/go-isatty/isatty_windows.go b/vendor/github.com/mattn/go-isatty/isatty_windows.go index 8e3c991..367adab 100644 --- a/vendor/github.com/mattn/go-isatty/isatty_windows.go +++ b/vendor/github.com/mattn/go-isatty/isatty_windows.go @@ -42,7 +42,8 @@ func IsTerminal(fd uintptr) bool { // Check pipe name is used for cygwin/msys2 pty. // Cygwin/MSYS2 PTY has a name like: -// \{cygwin,msys}-XXXXXXXXXXXXXXXX-ptyN-{from,to}-master +// +// \{cygwin,msys}-XXXXXXXXXXXXXXXX-ptyN-{from,to}-master func isCygwinPipeName(name string) bool { token := strings.Split(name, "-") if len(token) < 5 { diff --git a/vendor/github.com/mitchellh/copystructure/copystructure.go b/vendor/github.com/mitchellh/copystructure/copystructure.go index 8089e66..bf4b5df 100644 --- a/vendor/github.com/mitchellh/copystructure/copystructure.go +++ b/vendor/github.com/mitchellh/copystructure/copystructure.go @@ -18,20 +18,19 @@ const tagKey = "copy" // // For structs, copy behavior can be controlled with struct tags. For example: // -// struct { -// Name string -// Data *bytes.Buffer `copy:"shallow"` -// } +// struct { +// Name string +// Data *bytes.Buffer `copy:"shallow"` +// } // // The available tag values are: // -// * "ignore" - The field will be ignored, effectively resulting in it being -// assigned the zero value in the copy. -// -// * "shallow" - The field will be be shallow copied. This means that references -// values such as pointers, maps, slices, etc. will be directly assigned -// versus deep copied. +// - "ignore" - The field will be ignored, effectively resulting in it being +// assigned the zero value in the copy. // +// - "shallow" - The field will be be shallow copied. This means that references +// values such as pointers, maps, slices, etc. will be directly assigned +// versus deep copied. func Copy(v interface{}) (interface{}, error) { return Config{}.Copy(v) } diff --git a/vendor/github.com/mitchellh/mapstructure/mapstructure.go b/vendor/github.com/mitchellh/mapstructure/mapstructure.go index 1efb22a..fadccc4 100644 --- a/vendor/github.com/mitchellh/mapstructure/mapstructure.go +++ b/vendor/github.com/mitchellh/mapstructure/mapstructure.go @@ -9,84 +9,84 @@ // // The simplest function to start with is Decode. // -// Field Tags +// # Field Tags // // When decoding to a struct, mapstructure will use the field name by // default to perform the mapping. For example, if a struct has a field // "Username" then mapstructure will look for a key in the source value // of "username" (case insensitive). // -// type User struct { -// Username string -// } +// type User struct { +// Username string +// } // // You can change the behavior of mapstructure by using struct tags. // The default struct tag that mapstructure looks for is "mapstructure" // but you can customize it using DecoderConfig. // -// Renaming Fields +// # Renaming Fields // // To rename the key that mapstructure looks for, use the "mapstructure" // tag and set a value directly. For example, to change the "username" example // above to "user": // -// type User struct { -// Username string `mapstructure:"user"` -// } +// type User struct { +// Username string `mapstructure:"user"` +// } // -// Embedded Structs and Squashing +// # Embedded Structs and Squashing // // Embedded structs are treated as if they're another field with that name. // By default, the two structs below are equivalent when decoding with // mapstructure: // -// type Person struct { -// Name string -// } +// type Person struct { +// Name string +// } // -// type Friend struct { -// Person -// } +// type Friend struct { +// Person +// } // -// type Friend struct { -// Person Person -// } +// type Friend struct { +// Person Person +// } // // This would require an input that looks like below: // -// map[string]interface{}{ -// "person": map[string]interface{}{"name": "alice"}, -// } +// map[string]interface{}{ +// "person": map[string]interface{}{"name": "alice"}, +// } // // If your "person" value is NOT nested, then you can append ",squash" to // your tag value and mapstructure will treat it as if the embedded struct // were part of the struct directly. Example: // -// type Friend struct { -// Person `mapstructure:",squash"` -// } +// type Friend struct { +// Person `mapstructure:",squash"` +// } // // Now the following input would be accepted: // -// map[string]interface{}{ -// "name": "alice", -// } +// map[string]interface{}{ +// "name": "alice", +// } // // When decoding from a struct to a map, the squash tag squashes the struct // fields into a single map. Using the example structs from above: // -// Friend{Person: Person{Name: "alice"}} +// Friend{Person: Person{Name: "alice"}} // // Will be decoded into a map: // -// map[string]interface{}{ -// "name": "alice", -// } +// map[string]interface{}{ +// "name": "alice", +// } // // DecoderConfig has a field that changes the behavior of mapstructure // to always squash embedded structs. // -// Remainder Values +// # Remainder Values // // If there are any unmapped keys in the source value, mapstructure by // default will silently ignore them. You can error by setting ErrorUnused @@ -98,20 +98,20 @@ // probably be a "map[string]interface{}" or "map[interface{}]interface{}". // See example below: // -// type Friend struct { -// Name string -// Other map[string]interface{} `mapstructure:",remain"` -// } +// type Friend struct { +// Name string +// Other map[string]interface{} `mapstructure:",remain"` +// } // // Given the input below, Other would be populated with the other // values that weren't used (everything but "name"): // -// map[string]interface{}{ -// "name": "bob", -// "address": "123 Maple St.", -// } +// map[string]interface{}{ +// "name": "bob", +// "address": "123 Maple St.", +// } // -// Omit Empty Values +// # Omit Empty Values // // When decoding from a struct to any other value, you may use the // ",omitempty" suffix on your tag to omit that value if it equates to @@ -122,37 +122,37 @@ // field value is zero and a numeric type, the field is empty, and it won't // be encoded into the destination type. // -// type Source struct { -// Age int `mapstructure:",omitempty"` -// } +// type Source struct { +// Age int `mapstructure:",omitempty"` +// } // -// Unexported fields +// # Unexported fields // // Since unexported (private) struct fields cannot be set outside the package // where they are defined, the decoder will simply skip them. // // For this output type definition: // -// type Exported struct { -// private string // this unexported field will be skipped -// Public string -// } +// type Exported struct { +// private string // this unexported field will be skipped +// Public string +// } // // Using this map as input: // -// map[string]interface{}{ -// "private": "I will be ignored", -// "Public": "I made it through!", -// } +// map[string]interface{}{ +// "private": "I will be ignored", +// "Public": "I made it through!", +// } // // The following struct will be decoded: // -// type Exported struct { -// private: "" // field is left with an empty string (zero value) -// Public: "I made it through!" -// } +// type Exported struct { +// private: "" // field is left with an empty string (zero value) +// Public: "I made it through!" +// } // -// Other Configuration +// # Other Configuration // // mapstructure is highly configurable. See the DecoderConfig struct // for other features and options that are supported. diff --git a/vendor/github.com/mitchellh/reflectwalk/reflectwalk.go b/vendor/github.com/mitchellh/reflectwalk/reflectwalk.go index 7fee7b0..2f7a976 100644 --- a/vendor/github.com/mitchellh/reflectwalk/reflectwalk.go +++ b/vendor/github.com/mitchellh/reflectwalk/reflectwalk.go @@ -81,7 +81,6 @@ type PointerValueWalker interface { // // - Struct: skips all fields from being walked // - StructField: skips walking the struct value -// var SkipEntry = errors.New("skip this entry") // Walk takes an arbitrary value and an interface and traverses the diff --git a/vendor/github.com/pmezard/go-difflib/difflib/difflib.go b/vendor/github.com/pmezard/go-difflib/difflib/difflib.go index 003e99f..2a73737 100644 --- a/vendor/github.com/pmezard/go-difflib/difflib/difflib.go +++ b/vendor/github.com/pmezard/go-difflib/difflib/difflib.go @@ -199,12 +199,15 @@ func (m *SequenceMatcher) isBJunk(s string) bool { // If IsJunk is not defined: // // Return (i,j,k) such that a[i:i+k] is equal to b[j:j+k], where -// alo <= i <= i+k <= ahi -// blo <= j <= j+k <= bhi +// +// alo <= i <= i+k <= ahi +// blo <= j <= j+k <= bhi +// // and for all (i',j',k') meeting those conditions, -// k >= k' -// i <= i' -// and if i == i', j <= j' +// +// k >= k' +// i <= i' +// and if i == i', j <= j' // // In other words, of all maximal matching blocks, return one that // starts earliest in a, and of all those maximal matching blocks that diff --git a/vendor/github.com/redis/go-redis/v9/ring.go b/vendor/github.com/redis/go-redis/v9/ring.go index 4ae0054..f2ee848 100644 --- a/vendor/github.com/redis/go-redis/v9/ring.go +++ b/vendor/github.com/redis/go-redis/v9/ring.go @@ -13,7 +13,6 @@ import ( "github.com/cespare/xxhash/v2" "github.com/dgryski/go-rendezvous" //nolint - "github.com/redis/go-redis/v9/internal" "github.com/redis/go-redis/v9/internal/hashtag" "github.com/redis/go-redis/v9/internal/pool" diff --git a/vendor/github.com/rubenv/sql-migrate/migrate.go b/vendor/github.com/rubenv/sql-migrate/migrate.go index 7fb56f1..ff15e2f 100644 --- a/vendor/github.com/rubenv/sql-migrate/migrate.go +++ b/vendor/github.com/rubenv/sql-migrate/migrate.go @@ -18,7 +18,6 @@ import ( "time" "github.com/go-gorp/gorp/v3" - "github.com/rubenv/sql-migrate/sqlparse" ) diff --git a/vendor/github.com/swaggo/swag/schema.go b/vendor/github.com/swaggo/swag/schema.go index b3a5b38..c78a435 100644 --- a/vendor/github.com/swaggo/swag/schema.go +++ b/vendor/github.com/swaggo/swag/schema.go @@ -3,6 +3,7 @@ package swag import ( "errors" "fmt" + "github.com/go-openapi/spec" ) diff --git a/vendor/github.com/valyala/fasttemplate/template.go b/vendor/github.com/valyala/fasttemplate/template.go index f2d3261..c2df361 100644 --- a/vendor/github.com/valyala/fasttemplate/template.go +++ b/vendor/github.com/valyala/fasttemplate/template.go @@ -65,9 +65,9 @@ func ExecuteFunc(template, startTag, endTag string, w io.Writer, f TagFunc) (int // values from the map m and writes the result to the given writer w. // // Substitution map m may contain values with the following types: -// * []byte - the fastest value type -// * string - convenient value type -// * TagFunc - flexible value type +// - []byte - the fastest value type +// - string - convenient value type +// - TagFunc - flexible value type // // Returns the number of bytes written to w. // @@ -81,9 +81,9 @@ func Execute(template, startTag, endTag string, w io.Writer, m map[string]interf // This can be used as a drop-in replacement for strings.Replacer // // Substitution map m may contain values with the following types: -// * []byte - the fastest value type -// * string - convenient value type -// * TagFunc - flexible value type +// - []byte - the fastest value type +// - string - convenient value type +// - TagFunc - flexible value type // // Returns the number of bytes written to w. // @@ -134,9 +134,9 @@ var byteBufferPool bytebufferpool.Pool // values from the map m and returns the result. // // Substitution map m may contain values with the following types: -// * []byte - the fastest value type -// * string - convenient value type -// * TagFunc - flexible value type +// - []byte - the fastest value type +// - string - convenient value type +// - TagFunc - flexible value type // // This function is optimized for constantly changing templates. // Use Template.ExecuteString for frozen templates. @@ -148,9 +148,9 @@ func ExecuteString(template, startTag, endTag string, m map[string]interface{}) // This can be used as a drop-in replacement for strings.Replacer // // Substitution map m may contain values with the following types: -// * []byte - the fastest value type -// * string - convenient value type -// * TagFunc - flexible value type +// - []byte - the fastest value type +// - string - convenient value type +// - TagFunc - flexible value type // // This function is optimized for constantly changing templates. // Use Template.ExecuteStringStd for frozen templates. @@ -304,9 +304,9 @@ func (t *Template) ExecuteFunc(w io.Writer, f TagFunc) (int64, error) { // values from the map m and writes the result to the given writer w. // // Substitution map m may contain values with the following types: -// * []byte - the fastest value type -// * string - convenient value type -// * TagFunc - flexible value type +// - []byte - the fastest value type +// - string - convenient value type +// - TagFunc - flexible value type // // Returns the number of bytes written to w. func (t *Template) Execute(w io.Writer, m map[string]interface{}) (int64, error) { @@ -317,9 +317,9 @@ func (t *Template) Execute(w io.Writer, m map[string]interface{}) (int64, error) // This can be used as a drop-in replacement for strings.Replacer // // Substitution map m may contain values with the following types: -// * []byte - the fastest value type -// * string - convenient value type -// * TagFunc - flexible value type +// - []byte - the fastest value type +// - string - convenient value type +// - TagFunc - flexible value type // // Returns the number of bytes written to w. func (t *Template) ExecuteStd(w io.Writer, m map[string]interface{}) (int64, error) { @@ -365,9 +365,9 @@ func (t *Template) ExecuteFuncStringWithErr(f TagFunc) (string, error) { // values from the map m and returns the result. // // Substitution map m may contain values with the following types: -// * []byte - the fastest value type -// * string - convenient value type -// * TagFunc - flexible value type +// - []byte - the fastest value type +// - string - convenient value type +// - TagFunc - flexible value type // // This function is optimized for frozen templates. // Use ExecuteString for constantly changing templates. @@ -379,9 +379,9 @@ func (t *Template) ExecuteString(m map[string]interface{}) string { // This can be used as a drop-in replacement for strings.Replacer // // Substitution map m may contain values with the following types: -// * []byte - the fastest value type -// * string - convenient value type -// * TagFunc - flexible value type +// - []byte - the fastest value type +// - string - convenient value type +// - TagFunc - flexible value type // // This function is optimized for frozen templates. // Use ExecuteStringStd for constantly changing templates. diff --git a/vendor/github.com/valyala/fasttemplate/unsafe.go b/vendor/github.com/valyala/fasttemplate/unsafe.go index 1020ca3..1d0bc9e 100644 --- a/vendor/github.com/valyala/fasttemplate/unsafe.go +++ b/vendor/github.com/valyala/fasttemplate/unsafe.go @@ -1,3 +1,4 @@ +//go:build !appengine // +build !appengine package fasttemplate diff --git a/vendor/golang.org/x/sys/unix/zsyscall_aix_ppc64_gccgo.go b/vendor/golang.org/x/sys/unix/zsyscall_aix_ppc64_gccgo.go index 0a87450..d46b706 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_aix_ppc64_gccgo.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_aix_ppc64_gccgo.go @@ -127,6 +127,7 @@ uintptr_t mmap64(uintptr_t, uintptr_t, int, int, int, long long); */ import "C" + import ( "syscall" "unsafe" diff --git a/vendor/gopkg.in/natefinch/lumberjack.v2/lumberjack.go b/vendor/gopkg.in/natefinch/lumberjack.v2/lumberjack.go index 3447cdc..8fe043e 100644 --- a/vendor/gopkg.in/natefinch/lumberjack.v2/lumberjack.go +++ b/vendor/gopkg.in/natefinch/lumberjack.v2/lumberjack.go @@ -3,7 +3,7 @@ // Note that this is v2.0 of lumberjack, and should be imported using gopkg.in // thusly: // -// import "gopkg.in/natefinch/lumberjack.v2" +// import "gopkg.in/natefinch/lumberjack.v2" // // The package name remains simply lumberjack, and the code resides at // https://github.com/natefinch/lumberjack under the v2.0 branch. @@ -66,7 +66,7 @@ var _ io.WriteCloser = (*Logger)(nil) // `/var/log/foo/server.log`, a backup created at 6:30pm on Nov 11 2016 would // use the filename `/var/log/foo/server-2016-11-04T18-30-00.000.log` // -// Cleaning Up Old Log Files +// # Cleaning Up Old Log Files // // Whenever a new logfile gets created, old log files may be deleted. The most // recent files according to the encoded timestamp will be retained, up to a diff --git a/vendor/gopkg.in/yaml.v2/emitterc.go b/vendor/gopkg.in/yaml.v2/emitterc.go index a1c2cc5..638a268 100644 --- a/vendor/gopkg.in/yaml.v2/emitterc.go +++ b/vendor/gopkg.in/yaml.v2/emitterc.go @@ -130,10 +130,9 @@ func yaml_emitter_emit(emitter *yaml_emitter_t, event *yaml_event_t) bool { // Check if we need to accumulate more events before emitting. // // We accumulate extra -// - 1 event for DOCUMENT-START -// - 2 events for SEQUENCE-START -// - 3 events for MAPPING-START -// +// - 1 event for DOCUMENT-START +// - 2 events for SEQUENCE-START +// - 3 events for MAPPING-START func yaml_emitter_need_more_events(emitter *yaml_emitter_t) bool { if emitter.events_head == len(emitter.events) { return true diff --git a/vendor/gopkg.in/yaml.v2/resolve.go b/vendor/gopkg.in/yaml.v2/resolve.go index 4120e0c..e29c364 100644 --- a/vendor/gopkg.in/yaml.v2/resolve.go +++ b/vendor/gopkg.in/yaml.v2/resolve.go @@ -180,7 +180,7 @@ func resolve(tag string, in string) (rtag string, out interface{}) { return yaml_INT_TAG, uintv } } else if strings.HasPrefix(plain, "-0b") { - intv, err := strconv.ParseInt("-" + plain[3:], 2, 64) + intv, err := strconv.ParseInt("-"+plain[3:], 2, 64) if err == nil { if true || intv == int64(int(intv)) { return yaml_INT_TAG, int(intv) diff --git a/vendor/gopkg.in/yaml.v2/scannerc.go b/vendor/gopkg.in/yaml.v2/scannerc.go index 0b9bb60..d634dca 100644 --- a/vendor/gopkg.in/yaml.v2/scannerc.go +++ b/vendor/gopkg.in/yaml.v2/scannerc.go @@ -1500,11 +1500,11 @@ func yaml_parser_scan_to_next_token(parser *yaml_parser_t) bool { // Scan a YAML-DIRECTIVE or TAG-DIRECTIVE token. // // Scope: -// %YAML 1.1 # a comment \n -// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -// %TAG !yaml! tag:yaml.org,2002: \n -// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // +// %YAML 1.1 # a comment \n +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +// %TAG !yaml! tag:yaml.org,2002: \n +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ func yaml_parser_scan_directive(parser *yaml_parser_t, token *yaml_token_t) bool { // Eat '%'. start_mark := parser.mark @@ -1601,11 +1601,11 @@ func yaml_parser_scan_directive(parser *yaml_parser_t, token *yaml_token_t) bool // Scan the directive name. // // Scope: -// %YAML 1.1 # a comment \n -// ^^^^ -// %TAG !yaml! tag:yaml.org,2002: \n -// ^^^ // +// %YAML 1.1 # a comment \n +// ^^^^ +// %TAG !yaml! tag:yaml.org,2002: \n +// ^^^ func yaml_parser_scan_directive_name(parser *yaml_parser_t, start_mark yaml_mark_t, name *[]byte) bool { // Consume the directive name. if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { @@ -1640,8 +1640,9 @@ func yaml_parser_scan_directive_name(parser *yaml_parser_t, start_mark yaml_mark // Scan the value of VERSION-DIRECTIVE. // // Scope: -// %YAML 1.1 # a comment \n -// ^^^^^^ +// +// %YAML 1.1 # a comment \n +// ^^^^^^ func yaml_parser_scan_version_directive_value(parser *yaml_parser_t, start_mark yaml_mark_t, major, minor *int8) bool { // Eat whitespaces. if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { @@ -1679,10 +1680,11 @@ const max_number_length = 2 // Scan the version number of VERSION-DIRECTIVE. // // Scope: -// %YAML 1.1 # a comment \n -// ^ -// %YAML 1.1 # a comment \n -// ^ +// +// %YAML 1.1 # a comment \n +// ^ +// %YAML 1.1 # a comment \n +// ^ func yaml_parser_scan_version_directive_number(parser *yaml_parser_t, start_mark yaml_mark_t, number *int8) bool { // Repeat while the next character is digit. @@ -1716,9 +1718,9 @@ func yaml_parser_scan_version_directive_number(parser *yaml_parser_t, start_mark // Scan the value of a TAG-DIRECTIVE token. // // Scope: -// %TAG !yaml! tag:yaml.org,2002: \n -// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // +// %TAG !yaml! tag:yaml.org,2002: \n +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ func yaml_parser_scan_tag_directive_value(parser *yaml_parser_t, start_mark yaml_mark_t, handle, prefix *[]byte) bool { var handle_value, prefix_value []byte diff --git a/vendor/gopkg.in/yaml.v2/sorter.go b/vendor/gopkg.in/yaml.v2/sorter.go index 4c45e66..2edd734 100644 --- a/vendor/gopkg.in/yaml.v2/sorter.go +++ b/vendor/gopkg.in/yaml.v2/sorter.go @@ -52,7 +52,7 @@ func (l keyList) Less(i, j int) bool { var ai, bi int var an, bn int64 if ar[i] == '0' || br[i] == '0' { - for j := i-1; j >= 0 && unicode.IsDigit(ar[j]); j-- { + for j := i - 1; j >= 0 && unicode.IsDigit(ar[j]); j-- { if ar[j] != '0' { an = 1 bn = 1 diff --git a/vendor/gopkg.in/yaml.v2/yaml.go b/vendor/gopkg.in/yaml.v2/yaml.go index 3081388..03756f6 100644 --- a/vendor/gopkg.in/yaml.v2/yaml.go +++ b/vendor/gopkg.in/yaml.v2/yaml.go @@ -2,8 +2,7 @@ // // Source code and other details for the project are available at GitHub: // -// https://github.com/go-yaml/yaml -// +// https://github.com/go-yaml/yaml package yaml import ( @@ -67,16 +66,15 @@ type Marshaler interface { // // For example: // -// type T struct { -// F int `yaml:"a,omitempty"` -// B int -// } -// var t T -// yaml.Unmarshal([]byte("a: 1\nb: 2"), &t) +// type T struct { +// F int `yaml:"a,omitempty"` +// B int +// } +// var t T +// yaml.Unmarshal([]byte("a: 1\nb: 2"), &t) // // See the documentation of Marshal for the format of tags and a list of // supported tag options. -// func Unmarshal(in []byte, out interface{}) (err error) { return unmarshal(in, out, false) } @@ -166,36 +164,35 @@ func unmarshal(in []byte, out interface{}, strict bool) (err error) { // // The field tag format accepted is: // -// `(...) yaml:"[][,[,]]" (...)` +// `(...) yaml:"[][,[,]]" (...)` // // The following flags are currently supported: // -// omitempty Only include the field if it's not set to the zero -// value for the type or to empty slices or maps. -// Zero valued structs will be omitted if all their public -// fields are zero, unless they implement an IsZero -// method (see the IsZeroer interface type), in which -// case the field will be excluded if IsZero returns true. +// omitempty Only include the field if it's not set to the zero +// value for the type or to empty slices or maps. +// Zero valued structs will be omitted if all their public +// fields are zero, unless they implement an IsZero +// method (see the IsZeroer interface type), in which +// case the field will be excluded if IsZero returns true. // -// flow Marshal using a flow style (useful for structs, -// sequences and maps). +// flow Marshal using a flow style (useful for structs, +// sequences and maps). // -// inline Inline the field, which must be a struct or a map, -// causing all of its fields or keys to be processed as if -// they were part of the outer struct. For maps, keys must -// not conflict with the yaml keys of other struct fields. +// inline Inline the field, which must be a struct or a map, +// causing all of its fields or keys to be processed as if +// they were part of the outer struct. For maps, keys must +// not conflict with the yaml keys of other struct fields. // // In addition, if the key is "-", the field is ignored. // // For example: // -// type T struct { -// F int `yaml:"a,omitempty"` -// B int -// } -// yaml.Marshal(&T{B: 2}) // Returns "b: 2\n" -// yaml.Marshal(&T{F: 1}} // Returns "a: 1\nb: 0\n" -// +// type T struct { +// F int `yaml:"a,omitempty"` +// B int +// } +// yaml.Marshal(&T{B: 2}) // Returns "b: 2\n" +// yaml.Marshal(&T{F: 1}} // Returns "a: 1\nb: 0\n" func Marshal(in interface{}) (out []byte, err error) { defer handleErr(&err) e := newEncoder() diff --git a/vendor/gopkg.in/yaml.v2/yamlh.go b/vendor/gopkg.in/yaml.v2/yamlh.go index f6a9c8e..640f9d9 100644 --- a/vendor/gopkg.in/yaml.v2/yamlh.go +++ b/vendor/gopkg.in/yaml.v2/yamlh.go @@ -408,7 +408,9 @@ type yaml_document_t struct { // The number of written bytes should be set to the size_read variable. // // [in,out] data A pointer to an application data specified by -// yaml_parser_set_input(). +// +// yaml_parser_set_input(). +// // [out] buffer The buffer to write the data from the source. // [in] size The size of the buffer. // [out] size_read The actual number of bytes read from the source. @@ -604,13 +606,14 @@ type yaml_parser_t struct { // @a buffer to the output. // // @param[in,out] data A pointer to an application data specified by -// yaml_emitter_set_output(). +// +// yaml_emitter_set_output(). +// // @param[in] buffer The buffer with bytes to be written. // @param[in] size The size of the buffer. // // @returns On success, the handler should return @c 1. If the handler failed, // the returned value should be @c 0. -// type yaml_write_handler_t func(emitter *yaml_emitter_t, buffer []byte) error type yaml_emitter_state_t int diff --git a/vendor/gopkg.in/yaml.v3/emitterc.go b/vendor/gopkg.in/yaml.v3/emitterc.go index 0f47c9c..dde20e5 100644 --- a/vendor/gopkg.in/yaml.v3/emitterc.go +++ b/vendor/gopkg.in/yaml.v3/emitterc.go @@ -162,10 +162,9 @@ func yaml_emitter_emit(emitter *yaml_emitter_t, event *yaml_event_t) bool { // Check if we need to accumulate more events before emitting. // // We accumulate extra -// - 1 event for DOCUMENT-START -// - 2 events for SEQUENCE-START -// - 3 events for MAPPING-START -// +// - 1 event for DOCUMENT-START +// - 2 events for SEQUENCE-START +// - 3 events for MAPPING-START func yaml_emitter_need_more_events(emitter *yaml_emitter_t) bool { if emitter.events_head == len(emitter.events) { return true @@ -241,7 +240,7 @@ func yaml_emitter_increase_indent(emitter *yaml_emitter_t, flow, indentless bool emitter.indent += 2 } else { // Everything else aligns to the chosen indentation. - emitter.indent = emitter.best_indent*((emitter.indent+emitter.best_indent)/emitter.best_indent) + emitter.indent = emitter.best_indent * ((emitter.indent + emitter.best_indent) / emitter.best_indent) } } return true diff --git a/vendor/gopkg.in/yaml.v3/scannerc.go b/vendor/gopkg.in/yaml.v3/scannerc.go index ca00701..30b1f08 100644 --- a/vendor/gopkg.in/yaml.v3/scannerc.go +++ b/vendor/gopkg.in/yaml.v3/scannerc.go @@ -1614,11 +1614,11 @@ func yaml_parser_scan_to_next_token(parser *yaml_parser_t) bool { // Scan a YAML-DIRECTIVE or TAG-DIRECTIVE token. // // Scope: -// %YAML 1.1 # a comment \n -// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -// %TAG !yaml! tag:yaml.org,2002: \n -// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // +// %YAML 1.1 # a comment \n +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +// %TAG !yaml! tag:yaml.org,2002: \n +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ func yaml_parser_scan_directive(parser *yaml_parser_t, token *yaml_token_t) bool { // Eat '%'. start_mark := parser.mark @@ -1719,11 +1719,11 @@ func yaml_parser_scan_directive(parser *yaml_parser_t, token *yaml_token_t) bool // Scan the directive name. // // Scope: -// %YAML 1.1 # a comment \n -// ^^^^ -// %TAG !yaml! tag:yaml.org,2002: \n -// ^^^ // +// %YAML 1.1 # a comment \n +// ^^^^ +// %TAG !yaml! tag:yaml.org,2002: \n +// ^^^ func yaml_parser_scan_directive_name(parser *yaml_parser_t, start_mark yaml_mark_t, name *[]byte) bool { // Consume the directive name. if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { @@ -1758,8 +1758,9 @@ func yaml_parser_scan_directive_name(parser *yaml_parser_t, start_mark yaml_mark // Scan the value of VERSION-DIRECTIVE. // // Scope: -// %YAML 1.1 # a comment \n -// ^^^^^^ +// +// %YAML 1.1 # a comment \n +// ^^^^^^ func yaml_parser_scan_version_directive_value(parser *yaml_parser_t, start_mark yaml_mark_t, major, minor *int8) bool { // Eat whitespaces. if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { @@ -1797,10 +1798,11 @@ const max_number_length = 2 // Scan the version number of VERSION-DIRECTIVE. // // Scope: -// %YAML 1.1 # a comment \n -// ^ -// %YAML 1.1 # a comment \n -// ^ +// +// %YAML 1.1 # a comment \n +// ^ +// %YAML 1.1 # a comment \n +// ^ func yaml_parser_scan_version_directive_number(parser *yaml_parser_t, start_mark yaml_mark_t, number *int8) bool { // Repeat while the next character is digit. @@ -1834,9 +1836,9 @@ func yaml_parser_scan_version_directive_number(parser *yaml_parser_t, start_mark // Scan the value of a TAG-DIRECTIVE token. // // Scope: -// %TAG !yaml! tag:yaml.org,2002: \n -// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // +// %TAG !yaml! tag:yaml.org,2002: \n +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ func yaml_parser_scan_tag_directive_value(parser *yaml_parser_t, start_mark yaml_mark_t, handle, prefix *[]byte) bool { var handle_value, prefix_value []byte @@ -2847,7 +2849,7 @@ func yaml_parser_scan_line_comment(parser *yaml_parser_t, token_mark yaml_mark_t continue } if parser.buffer[parser.buffer_pos+peek] == '#' { - seen := parser.mark.index+peek + seen := parser.mark.index + peek for { if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { return false @@ -2876,7 +2878,7 @@ func yaml_parser_scan_line_comment(parser *yaml_parser_t, token_mark yaml_mark_t parser.comments = append(parser.comments, yaml_comment_t{ token_mark: token_mark, start_mark: start_mark, - line: text, + line: text, }) } return true @@ -2910,7 +2912,7 @@ func yaml_parser_scan_comments(parser *yaml_parser_t, scan_mark yaml_mark_t) boo // the foot is the line below it. var foot_line = -1 if scan_mark.line > 0 { - foot_line = parser.mark.line-parser.newlines+1 + foot_line = parser.mark.line - parser.newlines + 1 if parser.newlines == 0 && parser.mark.column > 1 { foot_line++ } @@ -2996,7 +2998,7 @@ func yaml_parser_scan_comments(parser *yaml_parser_t, scan_mark yaml_mark_t) boo recent_empty = false // Consume until after the consumed comment line. - seen := parser.mark.index+peek + seen := parser.mark.index + peek for { if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { return false diff --git a/vendor/gopkg.in/yaml.v3/yaml.go b/vendor/gopkg.in/yaml.v3/yaml.go index 8cec6da..f0bedf3 100644 --- a/vendor/gopkg.in/yaml.v3/yaml.go +++ b/vendor/gopkg.in/yaml.v3/yaml.go @@ -17,8 +17,7 @@ // // Source code and other details for the project are available at GitHub: // -// https://github.com/go-yaml/yaml -// +// https://github.com/go-yaml/yaml package yaml import ( @@ -75,16 +74,15 @@ type Marshaler interface { // // For example: // -// type T struct { -// F int `yaml:"a,omitempty"` -// B int -// } -// var t T -// yaml.Unmarshal([]byte("a: 1\nb: 2"), &t) +// type T struct { +// F int `yaml:"a,omitempty"` +// B int +// } +// var t T +// yaml.Unmarshal([]byte("a: 1\nb: 2"), &t) // // See the documentation of Marshal for the format of tags and a list of // supported tag options. -// func Unmarshal(in []byte, out interface{}) (err error) { return unmarshal(in, out, false) } @@ -185,36 +183,35 @@ func unmarshal(in []byte, out interface{}, strict bool) (err error) { // // The field tag format accepted is: // -// `(...) yaml:"[][,[,]]" (...)` +// `(...) yaml:"[][,[,]]" (...)` // // The following flags are currently supported: // -// omitempty Only include the field if it's not set to the zero -// value for the type or to empty slices or maps. -// Zero valued structs will be omitted if all their public -// fields are zero, unless they implement an IsZero -// method (see the IsZeroer interface type), in which -// case the field will be excluded if IsZero returns true. +// omitempty Only include the field if it's not set to the zero +// value for the type or to empty slices or maps. +// Zero valued structs will be omitted if all their public +// fields are zero, unless they implement an IsZero +// method (see the IsZeroer interface type), in which +// case the field will be excluded if IsZero returns true. // -// flow Marshal using a flow style (useful for structs, -// sequences and maps). +// flow Marshal using a flow style (useful for structs, +// sequences and maps). // -// inline Inline the field, which must be a struct or a map, -// causing all of its fields or keys to be processed as if -// they were part of the outer struct. For maps, keys must -// not conflict with the yaml keys of other struct fields. +// inline Inline the field, which must be a struct or a map, +// causing all of its fields or keys to be processed as if +// they were part of the outer struct. For maps, keys must +// not conflict with the yaml keys of other struct fields. // // In addition, if the key is "-", the field is ignored. // // For example: // -// type T struct { -// F int `yaml:"a,omitempty"` -// B int -// } -// yaml.Marshal(&T{B: 2}) // Returns "b: 2\n" -// yaml.Marshal(&T{F: 1}} // Returns "a: 1\nb: 0\n" -// +// type T struct { +// F int `yaml:"a,omitempty"` +// B int +// } +// yaml.Marshal(&T{B: 2}) // Returns "b: 2\n" +// yaml.Marshal(&T{F: 1}} // Returns "a: 1\nb: 0\n" func Marshal(in interface{}) (out []byte, err error) { defer handleErr(&err) e := newEncoder() @@ -358,22 +355,21 @@ const ( // // For example: // -// var person struct { -// Name string -// Address yaml.Node -// } -// err := yaml.Unmarshal(data, &person) -// +// var person struct { +// Name string +// Address yaml.Node +// } +// err := yaml.Unmarshal(data, &person) +// // Or by itself: // -// var person Node -// err := yaml.Unmarshal(data, &person) -// +// var person Node +// err := yaml.Unmarshal(data, &person) type Node struct { // Kind defines whether the node is a document, a mapping, a sequence, // a scalar value, or an alias to another node. The specific data type of // scalar nodes may be obtained via the ShortTag and LongTag methods. - Kind Kind + Kind Kind // Style allows customizing the apperance of the node in the tree. Style Style @@ -421,7 +417,6 @@ func (n *Node) IsZero() bool { n.HeadComment == "" && n.LineComment == "" && n.FootComment == "" && n.Line == 0 && n.Column == 0 } - // LongTag returns the long form of the tag that indicates the data type for // the node. If the Tag field isn't explicitly defined, one will be computed // based on the node properties. diff --git a/vendor/gopkg.in/yaml.v3/yamlh.go b/vendor/gopkg.in/yaml.v3/yamlh.go index 7c6d007..ddcd551 100644 --- a/vendor/gopkg.in/yaml.v3/yamlh.go +++ b/vendor/gopkg.in/yaml.v3/yamlh.go @@ -438,7 +438,9 @@ type yaml_document_t struct { // The number of written bytes should be set to the size_read variable. // // [in,out] data A pointer to an application data specified by -// yaml_parser_set_input(). +// +// yaml_parser_set_input(). +// // [out] buffer The buffer to write the data from the source. // [in] size The size of the buffer. // [out] size_read The actual number of bytes read from the source. @@ -639,7 +641,6 @@ type yaml_parser_t struct { } type yaml_comment_t struct { - scan_mark yaml_mark_t // Position where scanning for comments started token_mark yaml_mark_t // Position after which tokens will be associated with this comment start_mark yaml_mark_t // Position of '#' comment mark @@ -659,13 +660,14 @@ type yaml_comment_t struct { // @a buffer to the output. // // @param[in,out] data A pointer to an application data specified by -// yaml_emitter_set_output(). +// +// yaml_emitter_set_output(). +// // @param[in] buffer The buffer with bytes to be written. // @param[in] size The size of the buffer. // // @returns On success, the handler should return @c 1. If the handler failed, // the returned value should be @c 0. -// type yaml_write_handler_t func(emitter *yaml_emitter_t, buffer []byte) error type yaml_emitter_state_t int