mirror of https://github.com/zhufuyi/sponge
docs: update api document
This commit is contained in:
parent
5c44839aa9
commit
1cd6432b17
|
@ -13,15 +13,13 @@ import "tagger/tagger.proto";
|
|||
|
||||
option go_package = "github.com/go-dev-frame/sponge/api/serverNameExample/v1;v1";
|
||||
|
||||
// Default settings for generating *.swagger.json documents
|
||||
// NOTE: because json does not support 64 bits, the int64 and uint64 types under *.swagger.json are automatically converted to string types
|
||||
// Reference https://github.com/grpc-ecosystem/grpc-gateway/blob/db7fbefff7c04877cdb32e16d4a248a024428207/examples/internal/proto/examplepb/a_bit_of_everything.proto
|
||||
// Default settings for generating *.swagger.json documents. For reference, see: https://bit.ly/4dE5jj7
|
||||
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_swagger) = {
|
||||
host: "localhost:8080"
|
||||
base_path: ""
|
||||
info: {
|
||||
title: "serverNameExample api docs";
|
||||
version: "2.0";
|
||||
version: "v1.0.0";
|
||||
}
|
||||
schemes: HTTP;
|
||||
schemes: HTTPS;
|
||||
|
@ -41,26 +39,26 @@ option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_swagger) = {
|
|||
};
|
||||
|
||||
service userExample {
|
||||
// create userExample
|
||||
// create a new userExample
|
||||
rpc Create(CreateUserExampleRequest) returns (CreateUserExampleReply) {
|
||||
option (google.api.http) = {
|
||||
post: "/api/v1/userExample"
|
||||
body: "*"
|
||||
};
|
||||
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
|
||||
summary: "create userExample",
|
||||
description: "submit information to create userExample",
|
||||
summary: "create a new userExample";
|
||||
description: "Creates a new userExample entity using the provided data in the request body.";
|
||||
};
|
||||
}
|
||||
|
||||
// delete userExample by id
|
||||
// delete a userExample by id
|
||||
rpc DeleteByID(DeleteUserExampleByIDRequest) returns (DeleteUserExampleByIDReply) {
|
||||
option (google.api.http) = {
|
||||
delete: "/api/v1/userExample/{id}"
|
||||
};
|
||||
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
|
||||
summary: "delete userExample",
|
||||
description: "delete userExample by id",
|
||||
summary: "delete a userExample by id";
|
||||
description: "Deletes a existing userExample identified by the given id in the path.";
|
||||
//security: {
|
||||
// security_requirement: {
|
||||
// key: "BearerAuth";
|
||||
|
@ -70,15 +68,15 @@ service userExample {
|
|||
};
|
||||
}
|
||||
|
||||
// update userExample by id
|
||||
// update a userExample by id
|
||||
rpc UpdateByID(UpdateUserExampleByIDRequest) returns (UpdateUserExampleByIDReply) {
|
||||
option (google.api.http) = {
|
||||
put: "/api/v1/userExample/{id}"
|
||||
body: "*"
|
||||
};
|
||||
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
|
||||
summary: "update userExample",
|
||||
description: "update userExample by id",
|
||||
summary: "update a userExample by id";
|
||||
description: "Updates the specified userExample with new data provided in the request body. The target is identified by id in the path.";
|
||||
//security: {
|
||||
// security_requirement: {
|
||||
// key: "BearerAuth";
|
||||
|
@ -88,14 +86,14 @@ service userExample {
|
|||
};
|
||||
}
|
||||
|
||||
// get userExample by id
|
||||
// get userExample details by id
|
||||
rpc GetByID(GetUserExampleByIDRequest) returns (GetUserExampleByIDReply) {
|
||||
option (google.api.http) = {
|
||||
get: "/api/v1/userExample/{id}"
|
||||
};
|
||||
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
|
||||
summary: "get userExample detail",
|
||||
description: "get userExample detail by id",
|
||||
summary: "get userExample details by id";
|
||||
description: "Gets detailed information of a userExample specified by the given id in the path.";
|
||||
//security: {
|
||||
// security_requirement: {
|
||||
// key: "BearerAuth";
|
||||
|
@ -105,15 +103,15 @@ service userExample {
|
|||
};
|
||||
}
|
||||
|
||||
// list of userExample by query parameters
|
||||
// get a list of userExamples by custom conditions
|
||||
rpc List(ListUserExampleRequest) returns (ListUserExampleReply) {
|
||||
option (google.api.http) = {
|
||||
post: "/api/v1/userExample/list"
|
||||
body: "*"
|
||||
};
|
||||
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
|
||||
summary: "list of userExamples by query parameters",
|
||||
description: "list of userExamples by paging and conditions",
|
||||
summary: "get a list of userExamples by custom conditions";
|
||||
description: "Returns a paginated list of userExamples filtered by specified query parameters. The request supports pagination (page number, page size) and filtering conditions.";
|
||||
//security: {
|
||||
// security_requirement: {
|
||||
// key: "BearerAuth";
|
||||
|
@ -139,11 +137,14 @@ If used to generate code that supports the HTTP protocol, notes for defining mes
|
|||
2. If the request url is followed by a query parameter, such as /api/v1/getUserExample?name=Tom,
|
||||
a form tag must be added when defining the query parameter in the message, such as:
|
||||
string name = 1 [(tagger.tags) = "form:\"name\""].
|
||||
3. If the message field name contain underscores(such as 'field_name'), it will cause a problem
|
||||
where the JSON field names of the Swagger request parameters are different from those of the
|
||||
GRPC JSON tag names. There are two solutions: Solution 1, remove the underline from the
|
||||
message field name. Option 2, use the tool 'protoc-go-inject-tag' to modify the JSON tag name,
|
||||
such as: string first_name = 1 ; // @gotags: json:"firstName"
|
||||
3. When the message fields use snake_case naming (e.g., order_id), the generated swagger.json file
|
||||
will use camelCase (e.g., orderId) instead of the expected snake_case. This behavior aligns with
|
||||
the JSON tag names used by gRPC, but it can cause the Gin framework to fail to correctly bind and
|
||||
retrieve parameter values. There are two ways to resolve this issue:
|
||||
(1) Explicitly specify the JSON tag name using the json_name option, such as:
|
||||
string order_id = 1 [json_name = "order_id"];
|
||||
(2) If you want to switch to camelCase naming and update the JSON tag name accordingly, such as:
|
||||
string order_id = 1 [json_name = "orderID", (tagger.tags) = "json:\"orderID\""];
|
||||
*/
|
||||
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ import (
|
|||
// @title serverNameExample api docs
|
||||
// @description http server api docs
|
||||
// @schemes http https
|
||||
// @version 2.0
|
||||
// @version v1.0.0
|
||||
// @host localhost:8080
|
||||
// @securityDefinitions.apikey BearerAuth
|
||||
// @in header
|
||||
|
|
|
@ -10,7 +10,7 @@ import (
|
|||
// @title serverNameExample api docs
|
||||
// @description http server api docs
|
||||
// @schemes http https
|
||||
// @version 2.0
|
||||
// @version v1.0.0
|
||||
// @host localhost:8080
|
||||
// @securityDefinitions.apikey BearerAuth
|
||||
// @in header
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
"swagger": "2.0",
|
||||
"info": {
|
||||
"title": "serverNameExample api docs",
|
||||
"version": "2.0"
|
||||
"version": "v1.0.0"
|
||||
},
|
||||
"tags": [
|
||||
{
|
||||
|
@ -23,8 +23,8 @@
|
|||
"paths": {
|
||||
"/api/v1/userExample": {
|
||||
"post": {
|
||||
"summary": "create userExample",
|
||||
"description": "submit information to create userExample",
|
||||
"summary": "create a new userExample",
|
||||
"description": "Creates a new userExample entity using the provided data in the request body.",
|
||||
"operationId": "userExample_Create",
|
||||
"responses": {
|
||||
"200": {
|
||||
|
@ -57,8 +57,8 @@
|
|||
},
|
||||
"/api/v1/userExample/list": {
|
||||
"post": {
|
||||
"summary": "list of userExamples by query parameters",
|
||||
"description": "list of userExamples by paging and conditions",
|
||||
"summary": "get a list of userExamples by custom conditions",
|
||||
"description": "Returns a paginated list of userExamples filtered by specified query parameters. The request supports pagination (page number, page size) and filtering conditions.",
|
||||
"operationId": "userExample_List",
|
||||
"responses": {
|
||||
"200": {
|
||||
|
@ -91,8 +91,8 @@
|
|||
},
|
||||
"/api/v1/userExample/{id}": {
|
||||
"get": {
|
||||
"summary": "get userExample detail",
|
||||
"description": "get userExample detail by id",
|
||||
"summary": "get userExample details by id",
|
||||
"description": "Gets detailed information of a userExample specified by the given id in the path.",
|
||||
"operationId": "userExample_GetByID",
|
||||
"responses": {
|
||||
"200": {
|
||||
|
@ -122,8 +122,8 @@
|
|||
]
|
||||
},
|
||||
"delete": {
|
||||
"summary": "delete userExample",
|
||||
"description": "delete userExample by id",
|
||||
"summary": "delete a userExample by id",
|
||||
"description": "Deletes a existing userExample identified by the given id in the path.",
|
||||
"operationId": "userExample_DeleteByID",
|
||||
"responses": {
|
||||
"200": {
|
||||
|
@ -153,8 +153,8 @@
|
|||
]
|
||||
},
|
||||
"put": {
|
||||
"summary": "update userExample",
|
||||
"description": "update userExample by id",
|
||||
"summary": "update a userExample by id",
|
||||
"description": "Updates the specified userExample with new data provided in the request body. The target is identified by id in the path.",
|
||||
"operationId": "userExample_UpdateByID",
|
||||
"responses": {
|
||||
"200": {
|
||||
|
@ -183,39 +183,7 @@
|
|||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"name": {
|
||||
"type": "string"
|
||||
},
|
||||
"email": {
|
||||
"type": "string"
|
||||
},
|
||||
"password": {
|
||||
"type": "string"
|
||||
},
|
||||
"phone": {
|
||||
"type": "string"
|
||||
},
|
||||
"avatar": {
|
||||
"type": "string"
|
||||
},
|
||||
"age": {
|
||||
"type": "integer",
|
||||
"format": "int32"
|
||||
},
|
||||
"gender": {
|
||||
"$ref": "#/definitions/v1GenderType"
|
||||
},
|
||||
"status": {
|
||||
"type": "integer",
|
||||
"format": "int32"
|
||||
},
|
||||
"loginAt": {
|
||||
"type": "integer",
|
||||
"format": "int64"
|
||||
}
|
||||
}
|
||||
"$ref": "#/definitions/userExampleUpdateByIDBody"
|
||||
}
|
||||
}
|
||||
],
|
||||
|
@ -248,6 +216,7 @@
|
|||
"details": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"$ref": "#/definitions/protobufAny"
|
||||
}
|
||||
}
|
||||
|
@ -257,16 +226,20 @@
|
|||
"type": "object",
|
||||
"properties": {
|
||||
"name": {
|
||||
"type": "string"
|
||||
"type": "string",
|
||||
"title": "column name"
|
||||
},
|
||||
"exp": {
|
||||
"type": "string"
|
||||
"type": "string",
|
||||
"title": "expressions, default value is \"=\", support =, !=, \u003e, \u003e=, \u003c, \u003c=, like, in, notin"
|
||||
},
|
||||
"value": {
|
||||
"type": "string"
|
||||
"type": "string",
|
||||
"title": "column value"
|
||||
},
|
||||
"logic": {
|
||||
"type": "string"
|
||||
"type": "string",
|
||||
"title": "logical type, default value is \"and\", support \u0026, and, ||, or"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -275,20 +248,69 @@
|
|||
"properties": {
|
||||
"page": {
|
||||
"type": "integer",
|
||||
"format": "int32"
|
||||
"format": "int32",
|
||||
"title": "page number, starting from 0"
|
||||
},
|
||||
"limit": {
|
||||
"type": "integer",
|
||||
"format": "int32"
|
||||
"format": "int32",
|
||||
"title": "number per page"
|
||||
},
|
||||
"sort": {
|
||||
"type": "string"
|
||||
"type": "string",
|
||||
"title": "sorted fields, multi-column sorting separated by commas"
|
||||
},
|
||||
"columns": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"$ref": "#/definitions/typesColumn"
|
||||
}
|
||||
},
|
||||
"title": "query conditions"
|
||||
}
|
||||
}
|
||||
},
|
||||
"userExampleUpdateByIDBody": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"name": {
|
||||
"type": "string",
|
||||
"title": "name"
|
||||
},
|
||||
"email": {
|
||||
"type": "string",
|
||||
"title": "email"
|
||||
},
|
||||
"password": {
|
||||
"type": "string",
|
||||
"title": "password"
|
||||
},
|
||||
"phone": {
|
||||
"type": "string",
|
||||
"title": "phone number"
|
||||
},
|
||||
"avatar": {
|
||||
"type": "string",
|
||||
"title": "avatar"
|
||||
},
|
||||
"age": {
|
||||
"type": "integer",
|
||||
"format": "int32",
|
||||
"title": "age"
|
||||
},
|
||||
"gender": {
|
||||
"$ref": "#/definitions/v1GenderType",
|
||||
"title": "gender, 1:Male, 2:Female, other values:unknown"
|
||||
},
|
||||
"status": {
|
||||
"type": "integer",
|
||||
"format": "int32",
|
||||
"title": "account status"
|
||||
},
|
||||
"loginAt": {
|
||||
"type": "integer",
|
||||
"format": "int64",
|
||||
"title": "login timestamp"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -305,26 +327,33 @@
|
|||
"type": "object",
|
||||
"properties": {
|
||||
"name": {
|
||||
"type": "string"
|
||||
"type": "string",
|
||||
"title": "name"
|
||||
},
|
||||
"email": {
|
||||
"type": "string"
|
||||
"type": "string",
|
||||
"title": "email"
|
||||
},
|
||||
"password": {
|
||||
"type": "string"
|
||||
"type": "string",
|
||||
"title": "password"
|
||||
},
|
||||
"phone": {
|
||||
"type": "string"
|
||||
"type": "string",
|
||||
"title": "phone number"
|
||||
},
|
||||
"avatar": {
|
||||
"type": "string"
|
||||
"type": "string",
|
||||
"title": "avatar"
|
||||
},
|
||||
"age": {
|
||||
"type": "integer",
|
||||
"format": "int32"
|
||||
"format": "int32",
|
||||
"title": "age"
|
||||
},
|
||||
"gender": {
|
||||
"$ref": "#/definitions/v1GenderType"
|
||||
"$ref": "#/definitions/v1GenderType",
|
||||
"title": "gender, 1:Male, 2:Female, other values:unknown"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -358,6 +387,7 @@
|
|||
"userExamples": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"$ref": "#/definitions/v1UserExample"
|
||||
}
|
||||
}
|
||||
|
@ -382,37 +412,47 @@
|
|||
"format": "uint64"
|
||||
},
|
||||
"name": {
|
||||
"type": "string"
|
||||
"type": "string",
|
||||
"title": "name"
|
||||
},
|
||||
"email": {
|
||||
"type": "string"
|
||||
"type": "string",
|
||||
"title": "email"
|
||||
},
|
||||
"phone": {
|
||||
"type": "string"
|
||||
"type": "string",
|
||||
"title": "phone number"
|
||||
},
|
||||
"avatar": {
|
||||
"type": "string"
|
||||
"type": "string",
|
||||
"title": "avatar"
|
||||
},
|
||||
"age": {
|
||||
"type": "integer",
|
||||
"format": "int32"
|
||||
"format": "int32",
|
||||
"title": "age"
|
||||
},
|
||||
"gender": {
|
||||
"$ref": "#/definitions/v1GenderType"
|
||||
"$ref": "#/definitions/v1GenderType",
|
||||
"title": "gender, 1:Male, 2:Female, other values:unknown"
|
||||
},
|
||||
"status": {
|
||||
"type": "integer",
|
||||
"format": "int32"
|
||||
"format": "int32",
|
||||
"title": "account status"
|
||||
},
|
||||
"loginAt": {
|
||||
"type": "integer",
|
||||
"format": "int64"
|
||||
"format": "int64",
|
||||
"title": "login timestamp"
|
||||
},
|
||||
"createdAt": {
|
||||
"type": "string"
|
||||
"type": "string",
|
||||
"title": "creation time"
|
||||
},
|
||||
"updatedAt": {
|
||||
"type": "string"
|
||||
"type": "string",
|
||||
"title": "update time"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
75
docs/docs.go
75
docs/docs.go
|
@ -80,7 +80,7 @@ const docTemplate = `{
|
|||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/github_com_zhufuyi_sponge_internal_types.Params"
|
||||
"$ref": "#/definitions/github_com_go-dev-frame_sponge_internal_types.Params"
|
||||
}
|
||||
}
|
||||
],
|
||||
|
@ -212,7 +212,7 @@ const docTemplate = `{
|
|||
},
|
||||
"/codes": {
|
||||
"get": {
|
||||
"description": "list error codes info",
|
||||
"description": "Returns a list of all defined HTTP error codes and their descriptions",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
|
@ -222,13 +222,23 @@ const docTemplate = `{
|
|||
"tags": [
|
||||
"system"
|
||||
],
|
||||
"summary": "list error codes info",
|
||||
"responses": {}
|
||||
"summary": "list all error codes",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "List of error codes",
|
||||
"schema": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/errcode.ErrInfo"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/config": {
|
||||
"get": {
|
||||
"description": "show config info",
|
||||
"description": "Returns the current system configuration in JSON format. This includes all runtime configuration parameters.",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
|
@ -238,13 +248,21 @@ const docTemplate = `{
|
|||
"tags": [
|
||||
"system"
|
||||
],
|
||||
"summary": "show config info",
|
||||
"responses": {}
|
||||
"summary": "get system configuration",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "Returns the complete system configuration",
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"additionalProperties": true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/health": {
|
||||
"get": {
|
||||
"description": "check health",
|
||||
"description": "Returns system health information including status and hostname",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
|
@ -254,10 +272,10 @@ const docTemplate = `{
|
|||
"tags": [
|
||||
"system"
|
||||
],
|
||||
"summary": "check health",
|
||||
"summary": "check system health status",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"description": "Returns health status information",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/handlerfunc.CheckHealthReply"
|
||||
}
|
||||
|
@ -267,7 +285,7 @@ const docTemplate = `{
|
|||
},
|
||||
"/ping": {
|
||||
"get": {
|
||||
"description": "ping",
|
||||
"description": "Simple ping endpoint to check if server is responsive",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
|
@ -277,13 +295,31 @@ const docTemplate = `{
|
|||
"tags": [
|
||||
"system"
|
||||
],
|
||||
"summary": "ping",
|
||||
"responses": {}
|
||||
"summary": "ping the server",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "Returns empty JSON object",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/handlerfunc.PingReply"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"definitions": {
|
||||
"github_com_zhufuyi_sponge_internal_types.Column": {
|
||||
"errcode.ErrInfo": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"code": {
|
||||
"type": "integer"
|
||||
},
|
||||
"msg": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"github_com_go-dev-frame_sponge_internal_types.Column": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"exp": {
|
||||
|
@ -291,7 +327,7 @@ const docTemplate = `{
|
|||
"type": "string"
|
||||
},
|
||||
"logic": {
|
||||
"description": "logical type, defaults to and when value is null, only \u0026(and), ||(or)",
|
||||
"description": "logical type, default value is \"and\", support \u0026, and, ||, or",
|
||||
"type": "string"
|
||||
},
|
||||
"name": {
|
||||
|
@ -303,14 +339,14 @@ const docTemplate = `{
|
|||
}
|
||||
}
|
||||
},
|
||||
"github_com_zhufuyi_sponge_internal_types.Params": {
|
||||
"github_com_go-dev-frame_sponge_internal_types.Params": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"columns": {
|
||||
"description": "query conditions",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/github_com_zhufuyi_sponge_internal_types.Column"
|
||||
"$ref": "#/definitions/github_com_go-dev-frame_sponge_internal_types.Column"
|
||||
}
|
||||
},
|
||||
"limit": {
|
||||
|
@ -338,6 +374,9 @@ const docTemplate = `{
|
|||
}
|
||||
}
|
||||
},
|
||||
"handlerfunc.PingReply": {
|
||||
"type": "object"
|
||||
},
|
||||
"types.CreateUserExampleReply": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
|
@ -576,7 +615,7 @@ const docTemplate = `{
|
|||
|
||||
// SwaggerInfo holds exported Swagger Info so clients can modify it
|
||||
var SwaggerInfo = &swag.Spec{
|
||||
Version: "2.0",
|
||||
Version: "v1.0.0",
|
||||
Host: "localhost:8080",
|
||||
BasePath: "",
|
||||
Schemes: []string{"http", "https"},
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
"description": "http server api docs",
|
||||
"title": "serverNameExample api docs",
|
||||
"contact": {},
|
||||
"version": "2.0"
|
||||
"version": "v1.0.0"
|
||||
},
|
||||
"host": "localhost:8080",
|
||||
"paths": {
|
||||
|
@ -19,7 +19,7 @@
|
|||
"BearerAuth": []
|
||||
}
|
||||
],
|
||||
"description": "submit information to create userExample",
|
||||
"description": "Creates a new userExample entity using the provided data in the request body.",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
|
@ -29,7 +29,7 @@
|
|||
"tags": [
|
||||
"userExample"
|
||||
],
|
||||
"summary": "create userExample",
|
||||
"summary": "create a new userExample",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "userExample information",
|
||||
|
@ -58,7 +58,7 @@
|
|||
"BearerAuth": []
|
||||
}
|
||||
],
|
||||
"description": "list of userExamples by paging and conditions",
|
||||
"description": "Returns a paginated list of userExample based on query filters, including page number and size.",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
|
@ -68,7 +68,7 @@
|
|||
"tags": [
|
||||
"userExample"
|
||||
],
|
||||
"summary": "list of userExamples by query parameters",
|
||||
"summary": "get a list of userExample by custom conditions",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "query parameters",
|
||||
|
@ -76,7 +76,7 @@
|
|||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/github_com_zhufuyi_sponge_internal_types.Params"
|
||||
"$ref": "#/definitions/github_com_go-dev-frame_sponge_internal_types.Params"
|
||||
}
|
||||
}
|
||||
],
|
||||
|
@ -97,7 +97,7 @@
|
|||
"BearerAuth": []
|
||||
}
|
||||
],
|
||||
"description": "get userExample detail by id",
|
||||
"description": "Gets detailed information of a userExample specified by the given id in the path.",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
|
@ -107,7 +107,7 @@
|
|||
"tags": [
|
||||
"userExample"
|
||||
],
|
||||
"summary": "get userExample detail",
|
||||
"summary": "get userExample details by id",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
|
@ -132,7 +132,7 @@
|
|||
"BearerAuth": []
|
||||
}
|
||||
],
|
||||
"description": "update userExample information by id",
|
||||
"description": "Updates the specified userExample by given id in the path, support partial update.",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
|
@ -142,7 +142,7 @@
|
|||
"tags": [
|
||||
"userExample"
|
||||
],
|
||||
"summary": "update userExample",
|
||||
"summary": "update a userExample by id",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
|
@ -176,7 +176,7 @@
|
|||
"BearerAuth": []
|
||||
}
|
||||
],
|
||||
"description": "delete userExample by id",
|
||||
"description": "Deletes a existing userExample identified by the given id in the path.",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
|
@ -186,7 +186,7 @@
|
|||
"tags": [
|
||||
"userExample"
|
||||
],
|
||||
"summary": "delete userExample",
|
||||
"summary": "delete a userExample by id",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
|
@ -208,7 +208,7 @@
|
|||
},
|
||||
"/codes": {
|
||||
"get": {
|
||||
"description": "list error codes info",
|
||||
"description": "Returns a list of all defined HTTP error codes and their descriptions",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
|
@ -218,13 +218,23 @@
|
|||
"tags": [
|
||||
"system"
|
||||
],
|
||||
"summary": "list error codes info",
|
||||
"responses": {}
|
||||
"summary": "list all error codes",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "List of error codes",
|
||||
"schema": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/errcode.ErrInfo"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/config": {
|
||||
"get": {
|
||||
"description": "show config info",
|
||||
"description": "Returns the current system configuration in JSON format. This includes all runtime configuration parameters.",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
|
@ -234,13 +244,21 @@
|
|||
"tags": [
|
||||
"system"
|
||||
],
|
||||
"summary": "show config info",
|
||||
"responses": {}
|
||||
"summary": "get system configuration",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "Returns the complete system configuration",
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"additionalProperties": true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/health": {
|
||||
"get": {
|
||||
"description": "check health",
|
||||
"description": "Returns system health information including status and hostname",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
|
@ -250,10 +268,10 @@
|
|||
"tags": [
|
||||
"system"
|
||||
],
|
||||
"summary": "check health",
|
||||
"summary": "check system health status",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"description": "Returns health status information",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/handlerfunc.CheckHealthReply"
|
||||
}
|
||||
|
@ -263,7 +281,7 @@
|
|||
},
|
||||
"/ping": {
|
||||
"get": {
|
||||
"description": "ping",
|
||||
"description": "Simple ping endpoint to check if server is responsive",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
|
@ -273,13 +291,31 @@
|
|||
"tags": [
|
||||
"system"
|
||||
],
|
||||
"summary": "ping",
|
||||
"responses": {}
|
||||
"summary": "ping the server",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "Returns empty JSON object",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/handlerfunc.PingReply"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"definitions": {
|
||||
"github_com_zhufuyi_sponge_internal_types.Column": {
|
||||
"errcode.ErrInfo": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"code": {
|
||||
"type": "integer"
|
||||
},
|
||||
"msg": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"github_com_go-dev-frame_sponge_internal_types.Column": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"exp": {
|
||||
|
@ -287,7 +323,7 @@
|
|||
"type": "string"
|
||||
},
|
||||
"logic": {
|
||||
"description": "logical type, defaults to and when value is null, only \u0026(and), ||(or)",
|
||||
"description": "logical type, default value is \"and\", support \u0026, and, ||, or",
|
||||
"type": "string"
|
||||
},
|
||||
"name": {
|
||||
|
@ -299,14 +335,14 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"github_com_zhufuyi_sponge_internal_types.Params": {
|
||||
"github_com_go-dev-frame_sponge_internal_types.Params": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"columns": {
|
||||
"description": "query conditions",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/github_com_zhufuyi_sponge_internal_types.Column"
|
||||
"$ref": "#/definitions/github_com_go-dev-frame_sponge_internal_types.Column"
|
||||
}
|
||||
},
|
||||
"limit": {
|
||||
|
@ -334,6 +370,9 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"handlerfunc.PingReply": {
|
||||
"type": "object"
|
||||
},
|
||||
"types.CreateUserExampleReply": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
|
@ -568,4 +607,4 @@
|
|||
"in": "header"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,13 +1,19 @@
|
|||
definitions:
|
||||
github_com_zhufuyi_sponge_internal_types.Column:
|
||||
errcode.ErrInfo:
|
||||
properties:
|
||||
code:
|
||||
type: integer
|
||||
msg:
|
||||
type: string
|
||||
type: object
|
||||
github_com_go-dev-frame_sponge_internal_types.Column:
|
||||
properties:
|
||||
exp:
|
||||
description: expressions, which default to = when the value is null, have
|
||||
=, !=, >, >=, <, <=, like
|
||||
type: string
|
||||
logic:
|
||||
description: logical type, defaults to and when value is null, only &(and),
|
||||
||(or)
|
||||
description: logical type, default value is "and", support &, and, ||, or
|
||||
type: string
|
||||
name:
|
||||
description: column name
|
||||
|
@ -15,12 +21,12 @@ definitions:
|
|||
value:
|
||||
description: column value
|
||||
type: object
|
||||
github_com_zhufuyi_sponge_internal_types.Params:
|
||||
github_com_go-dev-frame_sponge_internal_types.Params:
|
||||
properties:
|
||||
columns:
|
||||
description: query conditions
|
||||
items:
|
||||
$ref: '#/definitions/github_com_zhufuyi_sponge_internal_types.Column'
|
||||
$ref: '#/definitions/github_com_go-dev-frame_sponge_internal_types.Column'
|
||||
type: array
|
||||
limit:
|
||||
description: lines per page
|
||||
|
@ -39,6 +45,8 @@ definitions:
|
|||
status:
|
||||
type: string
|
||||
type: object
|
||||
handlerfunc.PingReply:
|
||||
type: object
|
||||
types.CreateUserExampleReply:
|
||||
properties:
|
||||
code:
|
||||
|
@ -205,13 +213,14 @@ info:
|
|||
contact: {}
|
||||
description: http server api docs
|
||||
title: serverNameExample api docs
|
||||
version: "2.0"
|
||||
version: v1.0.0
|
||||
paths:
|
||||
/api/v1/userExample:
|
||||
post:
|
||||
consumes:
|
||||
- application/json
|
||||
description: submit information to create userExample
|
||||
description: Creates a new userExample entity using the provided data in the
|
||||
request body.
|
||||
parameters:
|
||||
- description: userExample information
|
||||
in: body
|
||||
|
@ -228,14 +237,15 @@ paths:
|
|||
$ref: '#/definitions/types.CreateUserExampleReply'
|
||||
security:
|
||||
- BearerAuth: []
|
||||
summary: create userExample
|
||||
summary: create a new userExample
|
||||
tags:
|
||||
- userExample
|
||||
/api/v1/userExample/{id}:
|
||||
delete:
|
||||
consumes:
|
||||
- application/json
|
||||
description: delete userExample by id
|
||||
description: Deletes a existing userExample identified by the given id in the
|
||||
path.
|
||||
parameters:
|
||||
- description: id
|
||||
in: path
|
||||
|
@ -251,13 +261,14 @@ paths:
|
|||
$ref: '#/definitions/types.DeleteUserExampleByIDReply'
|
||||
security:
|
||||
- BearerAuth: []
|
||||
summary: delete userExample
|
||||
summary: delete a userExample by id
|
||||
tags:
|
||||
- userExample
|
||||
get:
|
||||
consumes:
|
||||
- application/json
|
||||
description: get userExample detail by id
|
||||
description: Gets detailed information of a userExample specified by the given
|
||||
id in the path.
|
||||
parameters:
|
||||
- description: id
|
||||
in: path
|
||||
|
@ -273,13 +284,14 @@ paths:
|
|||
$ref: '#/definitions/types.GetUserExampleByIDReply'
|
||||
security:
|
||||
- BearerAuth: []
|
||||
summary: get userExample detail
|
||||
summary: get userExample details by id
|
||||
tags:
|
||||
- userExample
|
||||
put:
|
||||
consumes:
|
||||
- application/json
|
||||
description: update userExample information by id
|
||||
description: Updates the specified userExample by given id in the path, support
|
||||
partial update.
|
||||
parameters:
|
||||
- description: id
|
||||
in: path
|
||||
|
@ -301,21 +313,22 @@ paths:
|
|||
$ref: '#/definitions/types.UpdateUserExampleByIDReply'
|
||||
security:
|
||||
- BearerAuth: []
|
||||
summary: update userExample
|
||||
summary: update a userExample by id
|
||||
tags:
|
||||
- userExample
|
||||
/api/v1/userExample/list:
|
||||
post:
|
||||
consumes:
|
||||
- application/json
|
||||
description: list of userExamples by paging and conditions
|
||||
description: Returns a paginated list of userExample based on query filters,
|
||||
including page number and size.
|
||||
parameters:
|
||||
- description: query parameters
|
||||
in: body
|
||||
name: data
|
||||
required: true
|
||||
schema:
|
||||
$ref: '#/definitions/github_com_zhufuyi_sponge_internal_types.Params'
|
||||
$ref: '#/definitions/github_com_go-dev-frame_sponge_internal_types.Params'
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
|
@ -325,55 +338,71 @@ paths:
|
|||
$ref: '#/definitions/types.ListUserExamplesReply'
|
||||
security:
|
||||
- BearerAuth: []
|
||||
summary: list of userExamples by query parameters
|
||||
summary: get a list of userExample by custom conditions
|
||||
tags:
|
||||
- userExample
|
||||
/codes:
|
||||
get:
|
||||
consumes:
|
||||
- application/json
|
||||
description: list error codes info
|
||||
description: Returns a list of all defined HTTP error codes and their descriptions
|
||||
produces:
|
||||
- application/json
|
||||
responses: {}
|
||||
summary: list error codes info
|
||||
responses:
|
||||
"200":
|
||||
description: List of error codes
|
||||
schema:
|
||||
items:
|
||||
$ref: '#/definitions/errcode.ErrInfo'
|
||||
type: array
|
||||
summary: list all error codes
|
||||
tags:
|
||||
- system
|
||||
/config:
|
||||
get:
|
||||
consumes:
|
||||
- application/json
|
||||
description: show config info
|
||||
description: Returns the current system configuration in JSON format. This includes
|
||||
all runtime configuration parameters.
|
||||
produces:
|
||||
- application/json
|
||||
responses: {}
|
||||
summary: show config info
|
||||
responses:
|
||||
"200":
|
||||
description: Returns the complete system configuration
|
||||
schema:
|
||||
additionalProperties: true
|
||||
type: object
|
||||
summary: get system configuration
|
||||
tags:
|
||||
- system
|
||||
/health:
|
||||
get:
|
||||
consumes:
|
||||
- application/json
|
||||
description: check health
|
||||
description: Returns system health information including status and hostname
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
description: Returns health status information
|
||||
schema:
|
||||
$ref: '#/definitions/handlerfunc.CheckHealthReply'
|
||||
summary: check health
|
||||
summary: check system health status
|
||||
tags:
|
||||
- system
|
||||
/ping:
|
||||
get:
|
||||
consumes:
|
||||
- application/json
|
||||
description: ping
|
||||
description: Simple ping endpoint to check if server is responsive
|
||||
produces:
|
||||
- application/json
|
||||
responses: {}
|
||||
summary: ping
|
||||
responses:
|
||||
"200":
|
||||
description: Returns empty JSON object
|
||||
schema:
|
||||
$ref: '#/definitions/handlerfunc.PingReply'
|
||||
summary: ping the server
|
||||
tags:
|
||||
- system
|
||||
schemes:
|
||||
|
|
|
@ -56,12 +56,12 @@ func (d *userExampleDao) deleteCache(ctx context.Context, id uint64) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
// Create a record, insert the record and the id value is written back to the table
|
||||
// Create a new userExample, insert the record and the id value is written back to the table
|
||||
func (d *userExampleDao) Create(ctx context.Context, table *model.UserExample) error {
|
||||
return d.db.WithContext(ctx).Create(table).Error
|
||||
}
|
||||
|
||||
// DeleteByID delete a record by id
|
||||
// DeleteByID delete a userExample by id
|
||||
func (d *userExampleDao) DeleteByID(ctx context.Context, id uint64) error {
|
||||
err := d.db.WithContext(ctx).Where("id = ?", id).Delete(&model.UserExample{}).Error
|
||||
if err != nil {
|
||||
|
@ -74,7 +74,7 @@ func (d *userExampleDao) DeleteByID(ctx context.Context, id uint64) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
// UpdateByID update a record by id
|
||||
// UpdateByID update a userExample by id, support partial update
|
||||
func (d *userExampleDao) UpdateByID(ctx context.Context, table *model.UserExample) error {
|
||||
err := d.updateDataByID(ctx, d.db, table)
|
||||
|
||||
|
@ -121,7 +121,7 @@ func (d *userExampleDao) updateDataByID(ctx context.Context, db *gorm.DB, table
|
|||
return db.WithContext(ctx).Model(table).Updates(update).Error
|
||||
}
|
||||
|
||||
// GetByID get a record by id
|
||||
// GetByID get userExample details by id
|
||||
func (d *userExampleDao) GetByID(ctx context.Context, id uint64) (*model.UserExample, error) {
|
||||
// no cache
|
||||
if d.cache == nil {
|
||||
|
@ -175,7 +175,7 @@ func (d *userExampleDao) GetByID(ctx context.Context, id uint64) (*model.UserExa
|
|||
return nil, err
|
||||
}
|
||||
|
||||
// GetByColumns get paging records by column information.
|
||||
// GetByColumns get a list of userExample by custom conditions.
|
||||
// For more details, please refer to https://go-sponge.com/component/custom-page-query.html
|
||||
func (d *userExampleDao) GetByColumns(ctx context.Context, params *query.Params) ([]*model.UserExample, int64, error) {
|
||||
queryStr, args, err := params.ConvertToGormConditions(query.WithWhitelistNames(model.UserExampleColumnNames))
|
||||
|
|
|
@ -62,12 +62,12 @@ func (d *userExampleDao) deleteCache(ctx context.Context, id uint64) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
// Create a record, insert the record and the id value is written back to the table
|
||||
// Create a new userExample, insert the record and the id value is written back to the table
|
||||
func (d *userExampleDao) Create(ctx context.Context, table *model.UserExample) error {
|
||||
return d.db.WithContext(ctx).Create(table).Error
|
||||
}
|
||||
|
||||
// DeleteByID delete a record by id
|
||||
// DeleteByID delete a userExample by id
|
||||
func (d *userExampleDao) DeleteByID(ctx context.Context, id uint64) error {
|
||||
err := d.db.WithContext(ctx).Where("id = ?", id).Delete(&model.UserExample{}).Error
|
||||
if err != nil {
|
||||
|
@ -80,7 +80,7 @@ func (d *userExampleDao) DeleteByID(ctx context.Context, id uint64) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
// UpdateByID update a record by id
|
||||
// UpdateByID update a userExample by ids
|
||||
func (d *userExampleDao) UpdateByID(ctx context.Context, table *model.UserExample) error {
|
||||
err := d.updateDataByID(ctx, d.db, table)
|
||||
|
||||
|
@ -127,7 +127,7 @@ func (d *userExampleDao) updateDataByID(ctx context.Context, db *gorm.DB, table
|
|||
return db.WithContext(ctx).Model(table).Updates(update).Error
|
||||
}
|
||||
|
||||
// GetByID get a record by id
|
||||
// GetByID get userExample details by id
|
||||
func (d *userExampleDao) GetByID(ctx context.Context, id uint64) (*model.UserExample, error) {
|
||||
// no cache
|
||||
if d.cache == nil {
|
||||
|
@ -181,7 +181,7 @@ func (d *userExampleDao) GetByID(ctx context.Context, id uint64) (*model.UserExa
|
|||
return nil, err
|
||||
}
|
||||
|
||||
// GetByColumns get paging records by column information.
|
||||
// GetByColumns get a list of userExample by custom conditions.
|
||||
// For more details, please refer to https://go-sponge.com/component/custom-page-query.html
|
||||
func (d *userExampleDao) GetByColumns(ctx context.Context, params *query.Params) ([]*model.UserExample, int64, error) {
|
||||
queryStr, args, err := params.ConvertToGormConditions(query.WithWhitelistNames(model.UserExampleColumnNames))
|
||||
|
@ -210,7 +210,7 @@ func (d *userExampleDao) GetByColumns(ctx context.Context, params *query.Params)
|
|||
return records, total, err
|
||||
}
|
||||
|
||||
// DeleteByIDs delete records by batch id
|
||||
// DeleteByIDs delete userExample by batch id
|
||||
func (d *userExampleDao) DeleteByIDs(ctx context.Context, ids []uint64) error {
|
||||
err := d.db.WithContext(ctx).Where("id IN (?)", ids).Delete(&model.UserExample{}).Error
|
||||
if err != nil {
|
||||
|
@ -225,7 +225,7 @@ func (d *userExampleDao) DeleteByIDs(ctx context.Context, ids []uint64) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
// GetByCondition get a record by condition.
|
||||
// GetByCondition get userExample details by custom condition
|
||||
// For more details, please refer to https://go-sponge.com/component/custom-page-query.html#_2-condition-parameters-optional
|
||||
func (d *userExampleDao) GetByCondition(ctx context.Context, c *query.Conditions) (*model.UserExample, error) {
|
||||
queryStr, args, err := c.ConvertToGorm(query.WithWhitelistNames(model.UserExampleColumnNames))
|
||||
|
@ -242,7 +242,7 @@ func (d *userExampleDao) GetByCondition(ctx context.Context, c *query.Conditions
|
|||
return table, nil
|
||||
}
|
||||
|
||||
// GetByIDs get records by batch id
|
||||
// GetByIDs get a list of userExample by batch id
|
||||
func (d *userExampleDao) GetByIDs(ctx context.Context, ids []uint64) (map[uint64]*model.UserExample, error) {
|
||||
// no cache
|
||||
if d.cache == nil {
|
||||
|
@ -316,7 +316,7 @@ func (d *userExampleDao) GetByIDs(ctx context.Context, ids []uint64) (map[uint64
|
|||
return itemMap, nil
|
||||
}
|
||||
|
||||
// GetByLastID get paging records by last id and limit
|
||||
// GetByLastID get a list of userExample by last id
|
||||
func (d *userExampleDao) GetByLastID(ctx context.Context, lastID uint64, limit int, sort string) ([]*model.UserExample, error) {
|
||||
page := query.NewPage(0, limit, sort)
|
||||
|
||||
|
|
|
@ -62,12 +62,12 @@ func (d *{{.TableNameCamelFCL}}Dao) deleteCache(ctx context.Context, {{.ColumnNa
|
|||
return nil
|
||||
}
|
||||
|
||||
// Create a record, insert the record and the {{.ColumnNameCamelFCL}} value is written back to the table
|
||||
// Create a new {{.TableNameCamelFCL}}, insert the record and the {{.ColumnNameCamelFCL}} value is written back to the table
|
||||
func (d *{{.TableNameCamelFCL}}Dao) Create(ctx context.Context, table *model.{{.TableNameCamel}}) error {
|
||||
return d.db.WithContext(ctx).Create(table).Error
|
||||
}
|
||||
|
||||
// DeleteBy{{.ColumnNameCamel}} delete a record by {{.ColumnNameCamelFCL}}
|
||||
// DeleteBy{{.ColumnNameCamel}} delete a {{.TableNameCamelFCL}} by {{.ColumnNameCamelFCL}}
|
||||
func (d *{{.TableNameCamelFCL}}Dao) DeleteBy{{.ColumnNameCamel}}(ctx context.Context, {{.ColumnNameCamelFCL}} {{.GoType}}) error {
|
||||
err := d.db.WithContext(ctx).Where("{{.ColumnName}} = ?", {{.ColumnNameCamelFCL}}).Delete(&model.{{.TableNameCamel}}{}).Error
|
||||
if err != nil {
|
||||
|
@ -80,7 +80,7 @@ func (d *{{.TableNameCamelFCL}}Dao) DeleteBy{{.ColumnNameCamel}}(ctx context.Con
|
|||
return nil
|
||||
}
|
||||
|
||||
// UpdateBy{{.ColumnNameCamel}} update a record by {{.ColumnNameCamelFCL}}
|
||||
// UpdateBy{{.ColumnNameCamel}} update a {{.TableNameCamelFCL}} by {{.ColumnNameCamelFCL}}
|
||||
func (d *{{.TableNameCamelFCL}}Dao) UpdateBy{{.ColumnNameCamel}}(ctx context.Context, table *model.{{.TableNameCamel}}) error {
|
||||
err := d.updateDataBy{{.ColumnNameCamel}}(ctx, d.db, table)
|
||||
|
||||
|
@ -131,7 +131,7 @@ func (d *{{.TableNameCamelFCL}}Dao) updateDataBy{{.ColumnNameCamel}}(ctx context
|
|||
return db.WithContext(ctx).Model(table).Updates(update).Error
|
||||
}
|
||||
|
||||
// GetBy{{.ColumnNameCamel}} get a record by {{.ColumnNameCamelFCL}}
|
||||
// GetBy{{.ColumnNameCamel}} get {{.TableNameCamelFCL}} details by {{.ColumnNameCamelFCL}}
|
||||
func (d *{{.TableNameCamelFCL}}Dao) GetBy{{.ColumnNameCamel}}(ctx context.Context, {{.ColumnNameCamelFCL}} {{.GoType}}) (*model.{{.TableNameCamel}}, error) {
|
||||
// no cache
|
||||
if d.cache == nil {
|
||||
|
@ -187,7 +187,7 @@ func (d *{{.TableNameCamelFCL}}Dao) GetBy{{.ColumnNameCamel}}(ctx context.Contex
|
|||
return nil, err
|
||||
}
|
||||
|
||||
// GetByColumns get paging records by column information.
|
||||
// GetByColumns get a list of {{.TableNameCamelFCL}} by custom conditions.
|
||||
// For more details, please refer to https://go-sponge.com/component/custom-page-query.html
|
||||
func (d *{{.TableNameCamelFCL}}Dao) GetByColumns(ctx context.Context, params *query.Params) ([]*model.{{.TableNameCamel}}, int64, error) {
|
||||
if params.Sort == "" {
|
||||
|
@ -219,7 +219,7 @@ func (d *{{.TableNameCamelFCL}}Dao) GetByColumns(ctx context.Context, params *qu
|
|||
return records, total, err
|
||||
}
|
||||
|
||||
// DeleteBy{{.ColumnNamePluralCamel}} delete records by batch {{.ColumnNameCamelFCL}}
|
||||
// DeleteBy{{.ColumnNamePluralCamel}} delete {{.TableNameCamelFCL}} by batch {{.ColumnNameCamelFCL}}
|
||||
func (d *{{.TableNameCamelFCL}}Dao) DeleteBy{{.ColumnNamePluralCamel}}(ctx context.Context, {{.ColumnNamePluralCamelFCL}} []{{.GoType}}) error {
|
||||
err := d.db.WithContext(ctx).Where("{{.ColumnName}} IN (?)", {{.ColumnNamePluralCamelFCL}}).Delete(&model.{{.TableNameCamel}}{}).Error
|
||||
if err != nil {
|
||||
|
@ -234,7 +234,7 @@ func (d *{{.TableNameCamelFCL}}Dao) DeleteBy{{.ColumnNamePluralCamel}}(ctx conte
|
|||
return nil
|
||||
}
|
||||
|
||||
// GetByCondition get a record by condition
|
||||
// GetByCondition get {{.TableNameCamelFCL}} details by custom condition
|
||||
// For more details, please refer to https://go-sponge.com/component/custom-page-query.html#_2-condition-parameters-optional
|
||||
func (d *{{.TableNameCamelFCL}}Dao) GetByCondition(ctx context.Context, c *query.Conditions) (*model.{{.TableNameCamel}}, error) {
|
||||
queryStr, args, err := c.ConvertToGorm(query.WithWhitelistNames(model.{{.TableNameCamel}}ColumnNames))
|
||||
|
@ -251,7 +251,7 @@ func (d *{{.TableNameCamelFCL}}Dao) GetByCondition(ctx context.Context, c *query
|
|||
return table, nil
|
||||
}
|
||||
|
||||
// GetBy{{.ColumnNamePluralCamel}} get records by batch {{.ColumnNameCamelFCL}}
|
||||
// GetBy{{.ColumnNamePluralCamel}} get a list of {{.TableNameCamelFCL}} by batch {{.ColumnNameCamelFCL}}
|
||||
func (d *{{.TableNameCamelFCL}}Dao) GetBy{{.ColumnNamePluralCamel}}(ctx context.Context, {{.ColumnNamePluralCamelFCL}} []{{.GoType}}) (map[{{.GoType}}]*model.{{.TableNameCamel}}, error) {
|
||||
// no cache
|
||||
if d.cache == nil {
|
||||
|
@ -326,7 +326,7 @@ func (d *{{.TableNameCamelFCL}}Dao) GetBy{{.ColumnNamePluralCamel}}(ctx context.
|
|||
return itemMap, nil
|
||||
}
|
||||
|
||||
// GetByLast{{.ColumnNameCamel}} get paging records by last {{.ColumnNameCamelFCL}} and limit
|
||||
// GetByLast{{.ColumnNameCamel}} get a list of {{.TableNameCamelFCL}} by last {{.ColumnNameCamelFCL}}
|
||||
func (d *{{.TableNameCamelFCL}}Dao) GetByLast{{.ColumnNameCamel}}(ctx context.Context, last{{.ColumnNameCamel}} {{.GoType}}, limit int, sort string) ([]*model.{{.TableNameCamel}}, error) {
|
||||
if sort == "" {
|
||||
sort = "-{{.ColumnName}}"
|
||||
|
|
|
@ -56,7 +56,7 @@ func (d *userExampleDao) deleteCache(ctx context.Context, id string) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
// Create a record, insert the record and the id value is written back to the table
|
||||
// Create a new userExample, insert the record and the id value is written back to the table
|
||||
func (d *userExampleDao) Create(ctx context.Context, record *model.UserExample) error {
|
||||
if record.ID.IsZero() {
|
||||
record.ID = primitive.NewObjectID()
|
||||
|
@ -71,7 +71,7 @@ func (d *userExampleDao) Create(ctx context.Context, record *model.UserExample)
|
|||
return err
|
||||
}
|
||||
|
||||
// DeleteByID soft delete a record by id
|
||||
// DeleteByID delete a userExample by id
|
||||
func (d *userExampleDao) DeleteByID(ctx context.Context, id string) error {
|
||||
filter := bson.M{"_id": database.ToObjectID(id)}
|
||||
_, err := d.collection.UpdateOne(ctx, mgo.ExcludeDeleted(filter), mgo.EmbedDeletedAt(bson.M{}))
|
||||
|
@ -85,7 +85,7 @@ func (d *userExampleDao) DeleteByID(ctx context.Context, id string) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
// UpdateByID update a record by id
|
||||
// UpdateByID update a userExample by id
|
||||
func (d *userExampleDao) UpdateByID(ctx context.Context, record *model.UserExample) error {
|
||||
err := d.updateDataByID(ctx, d.collection, record)
|
||||
|
||||
|
@ -134,7 +134,7 @@ func (d *userExampleDao) updateDataByID(ctx context.Context, collection *mongo.C
|
|||
return err
|
||||
}
|
||||
|
||||
// GetByID get a record by id
|
||||
// GetByID get userExample details by id
|
||||
func (d *userExampleDao) GetByID(ctx context.Context, id string) (*model.UserExample, error) {
|
||||
oid := database.ToObjectID(id)
|
||||
if oid.IsZero() {
|
||||
|
@ -193,7 +193,7 @@ func (d *userExampleDao) GetByID(ctx context.Context, id string) (*model.UserExa
|
|||
return nil, err
|
||||
}
|
||||
|
||||
// GetByColumns get paging records by column information,
|
||||
// GetByColumns get a list of userExample by custom conditions.
|
||||
// For more details, please refer to https://go-sponge.com/component/custom-page-query.html
|
||||
func (d *userExampleDao) GetByColumns(ctx context.Context, params *query.Params) ([]*model.UserExample, int64, error) {
|
||||
filter, err := params.ConvertToMongoFilter(query.WithWhitelistNames(model.UserExampleColumnNames))
|
||||
|
|
|
@ -61,7 +61,7 @@ func (d *userExampleDao) deleteCache(ctx context.Context, id string) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
// Create a record, insert the record and the id value is written back to the table
|
||||
// Create a new userExample, insert the record and the id value is written back to the table
|
||||
func (d *userExampleDao) Create(ctx context.Context, record *model.UserExample) error {
|
||||
if record.ID.IsZero() {
|
||||
record.ID = primitive.NewObjectID()
|
||||
|
@ -76,7 +76,7 @@ func (d *userExampleDao) Create(ctx context.Context, record *model.UserExample)
|
|||
return err
|
||||
}
|
||||
|
||||
// DeleteByID soft delete a record by id
|
||||
// DeleteByID delete a userExample by id
|
||||
func (d *userExampleDao) DeleteByID(ctx context.Context, id string) error {
|
||||
filter := bson.M{"_id": database.ToObjectID(id)}
|
||||
_, err := d.collection.UpdateOne(ctx, mgo.ExcludeDeleted(filter), mgo.EmbedDeletedAt(bson.M{}))
|
||||
|
@ -90,7 +90,7 @@ func (d *userExampleDao) DeleteByID(ctx context.Context, id string) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
// UpdateByID update a record by id
|
||||
// UpdateByID update a userExample by id
|
||||
func (d *userExampleDao) UpdateByID(ctx context.Context, record *model.UserExample) error {
|
||||
err := d.updateDataByID(ctx, d.collection, record)
|
||||
|
||||
|
@ -139,7 +139,7 @@ func (d *userExampleDao) updateDataByID(ctx context.Context, collection *mongo.C
|
|||
return err
|
||||
}
|
||||
|
||||
// GetByID get a record by id
|
||||
// GetByID get userExample details by id
|
||||
func (d *userExampleDao) GetByID(ctx context.Context, id string) (*model.UserExample, error) {
|
||||
oid := database.ToObjectID(id)
|
||||
if oid.IsZero() {
|
||||
|
@ -198,7 +198,7 @@ func (d *userExampleDao) GetByID(ctx context.Context, id string) (*model.UserExa
|
|||
return nil, err
|
||||
}
|
||||
|
||||
// GetByColumns get paging records by column information,
|
||||
// GetByColumns get a list of userExample by custom conditions.
|
||||
// For more details, please refer to https://go-sponge.com/component/custom-page-query.html
|
||||
func (d *userExampleDao) GetByColumns(ctx context.Context, params *query.Params) ([]*model.UserExample, int64, error) {
|
||||
filter, err := params.ConvertToMongoFilter(query.WithWhitelistNames(model.UserExampleColumnNames))
|
||||
|
@ -232,7 +232,7 @@ func (d *userExampleDao) GetByColumns(ctx context.Context, params *query.Params)
|
|||
return records, total, err
|
||||
}
|
||||
|
||||
// DeleteByIDs soft delete records by batch id
|
||||
// DeleteByIDs delete userExample by batch id
|
||||
func (d *userExampleDao) DeleteByIDs(ctx context.Context, ids []string) error {
|
||||
oids := mgo.ConvertToObjectIDs(ids)
|
||||
filter := bson.M{"_id": bson.M{"$in": oids}}
|
||||
|
@ -249,7 +249,7 @@ func (d *userExampleDao) DeleteByIDs(ctx context.Context, ids []string) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
// GetByCondition get a record by condition
|
||||
// GetByCondition get userExample details by custom condition.
|
||||
// For more details, please refer to https://go-sponge.com/component/custom-page-query.html#_2-condition-parameters-optional
|
||||
func (d *userExampleDao) GetByCondition(ctx context.Context, c *query.Conditions) (*model.UserExample, error) {
|
||||
filter, err := c.ConvertToMongo(query.WithWhitelistNames(model.UserExampleColumnNames))
|
||||
|
@ -266,7 +266,7 @@ func (d *userExampleDao) GetByCondition(ctx context.Context, c *query.Conditions
|
|||
return record, nil
|
||||
}
|
||||
|
||||
// GetByIDs get records by batch id
|
||||
// GetByIDs get a list of userExample by batch id
|
||||
func (d *userExampleDao) GetByIDs(ctx context.Context, ids []string) (map[string]*model.UserExample, error) {
|
||||
// no cache
|
||||
if d.cache == nil {
|
||||
|
@ -352,7 +352,7 @@ func (d *userExampleDao) GetByIDs(ctx context.Context, ids []string) (map[string
|
|||
return itemMap, nil
|
||||
}
|
||||
|
||||
// GetByLastID get paging records by last id and limit
|
||||
// GetByLastID get a list of userExample by last id
|
||||
func (d *userExampleDao) GetByLastID(ctx context.Context, lastID string, limit int, sort string) ([]*model.UserExample, error) {
|
||||
page := query.NewPage(0, limit, sort)
|
||||
|
||||
|
|
|
@ -56,12 +56,12 @@ func (d *{{.TableNameCamelFCL}}Dao) deleteCache(ctx context.Context, {{.ColumnNa
|
|||
return nil
|
||||
}
|
||||
|
||||
// Create a record, insert the record and the {{.ColumnNameCamelFCL}} value is written back to the table
|
||||
// Create a new {{.TableNameCamelFCL}}, insert the record and the {{.ColumnNameCamelFCL}} value is written back to the table
|
||||
func (d *{{.TableNameCamelFCL}}Dao) Create(ctx context.Context, table *model.{{.TableNameCamel}}) error {
|
||||
return d.db.WithContext(ctx).Create(table).Error
|
||||
}
|
||||
|
||||
// DeleteBy{{.ColumnNameCamel}} delete a record by {{.ColumnNameCamelFCL}}
|
||||
// DeleteBy{{.ColumnNameCamel}} delete a {{.TableNameCamelFCL}} by {{.ColumnNameCamelFCL}}
|
||||
func (d *{{.TableNameCamelFCL}}Dao) DeleteBy{{.ColumnNameCamel}}(ctx context.Context, {{.ColumnNameCamelFCL}} {{.GoType}}) error {
|
||||
err := d.db.WithContext(ctx).Where("{{.ColumnName}} = ?", {{.ColumnNameCamelFCL}}).Delete(&model.{{.TableNameCamel}}{}).Error
|
||||
if err != nil {
|
||||
|
@ -74,7 +74,7 @@ func (d *{{.TableNameCamelFCL}}Dao) DeleteBy{{.ColumnNameCamel}}(ctx context.Con
|
|||
return nil
|
||||
}
|
||||
|
||||
// UpdateBy{{.ColumnNameCamel}} update a record by {{.ColumnNameCamelFCL}}
|
||||
// UpdateBy{{.ColumnNameCamel}} update a {{.TableNameCamelFCL}} by {{.ColumnNameCamelFCL}}
|
||||
func (d *{{.TableNameCamelFCL}}Dao) UpdateBy{{.ColumnNameCamel}}(ctx context.Context, table *model.{{.TableNameCamel}}) error {
|
||||
err := d.updateDataBy{{.ColumnNameCamel}}(ctx, d.db, table)
|
||||
|
||||
|
@ -125,7 +125,7 @@ func (d *{{.TableNameCamelFCL}}Dao) updateDataBy{{.ColumnNameCamel}}(ctx context
|
|||
return db.WithContext(ctx).Model(table).Updates(update).Error
|
||||
}
|
||||
|
||||
// GetBy{{.ColumnNameCamel}} get a record by {{.ColumnNameCamelFCL}}
|
||||
// GetBy{{.ColumnNameCamel}} get {{.TableNameCamelFCL}} details by {{.ColumnNameCamelFCL}}
|
||||
func (d *{{.TableNameCamelFCL}}Dao) GetBy{{.ColumnNameCamel}}(ctx context.Context, {{.ColumnNameCamelFCL}} {{.GoType}}) (*model.{{.TableNameCamel}}, error) {
|
||||
// no cache
|
||||
if d.cache == nil {
|
||||
|
@ -181,7 +181,7 @@ func (d *{{.TableNameCamelFCL}}Dao) GetBy{{.ColumnNameCamel}}(ctx context.Contex
|
|||
return nil, err
|
||||
}
|
||||
|
||||
// GetByColumns get paging records by column information.
|
||||
// GetByColumns get a list of {{.TableNameCamelFCL}} by custom conditions.
|
||||
// For more details, please refer to https://go-sponge.com/component/custom-page-query.html
|
||||
func (d *{{.TableNameCamelFCL}}Dao) GetByColumns(ctx context.Context, params *query.Params) ([]*model.{{.TableNameCamel}}, int64, error) {
|
||||
if params.Sort == "" {
|
||||
|
|
|
@ -44,11 +44,11 @@ func NewUserExampleHandler() UserExampleHandler {
|
|||
}
|
||||
}
|
||||
|
||||
// Create a record
|
||||
// @Summary create userExample
|
||||
// @Description submit information to create userExample
|
||||
// Create a new userExample
|
||||
// @Summary create a new userExample
|
||||
// @Description Creates a new userExample entity using the provided data in the request body.
|
||||
// @Tags userExample
|
||||
// @accept json
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param data body types.CreateUserExampleRequest true "userExample information"
|
||||
// @Success 200 {object} types.CreateUserExampleReply{}
|
||||
|
@ -82,11 +82,11 @@ func (h *userExampleHandler) Create(c *gin.Context) {
|
|||
response.Success(c, gin.H{"id": userExample.ID})
|
||||
}
|
||||
|
||||
// DeleteByID delete a record by id
|
||||
// @Summary delete userExample
|
||||
// @Description delete userExample by id
|
||||
// DeleteByID delete a userExample by id
|
||||
// @Summary delete a userExample by id
|
||||
// @Description Deletes a existing userExample identified by the given id in the path.
|
||||
// @Tags userExample
|
||||
// @accept json
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param id path string true "id"
|
||||
// @Success 200 {object} types.DeleteUserExampleByIDReply{}
|
||||
|
@ -110,11 +110,11 @@ func (h *userExampleHandler) DeleteByID(c *gin.Context) {
|
|||
response.Success(c)
|
||||
}
|
||||
|
||||
// UpdateByID update information by id
|
||||
// @Summary update userExample
|
||||
// @Description update userExample information by id
|
||||
// UpdateByID update a userExample by id
|
||||
// @Summary update a userExample by id
|
||||
// @Description Updates the specified userExample by given id in the path, support partial update.
|
||||
// @Tags userExample
|
||||
// @accept json
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param id path string true "id"
|
||||
// @Param data body types.UpdateUserExampleByIDRequest true "userExample information"
|
||||
|
@ -156,9 +156,9 @@ func (h *userExampleHandler) UpdateByID(c *gin.Context) {
|
|||
response.Success(c)
|
||||
}
|
||||
|
||||
// GetByID get a record by id
|
||||
// @Summary get userExample detail
|
||||
// @Description get userExample detail by id
|
||||
// GetByID get userExample details by id
|
||||
// @Summary get userExample details by id
|
||||
// @Description Gets detailed information of a userExample specified by the given id in the path.
|
||||
// @Tags userExample
|
||||
// @Param id path string true "id"
|
||||
// @Accept json
|
||||
|
@ -197,11 +197,11 @@ func (h *userExampleHandler) GetByID(c *gin.Context) {
|
|||
response.Success(c, gin.H{"userExample": data})
|
||||
}
|
||||
|
||||
// List of records by query parameters
|
||||
// @Summary list of userExamples by query parameters
|
||||
// @Description list of userExamples by paging and conditions
|
||||
// List get a list of userExample by custom conditions
|
||||
// @Summary get a list of userExample by custom conditions
|
||||
// @Description Returns a paginated list of userExample based on query filters, including page number and size.
|
||||
// @Tags userExample
|
||||
// @accept json
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param data body types.Params true "query parameters"
|
||||
// @Success 200 {object} types.ListUserExamplesReply{}
|
||||
|
|
|
@ -50,11 +50,11 @@ func NewUserExampleHandler() UserExampleHandler {
|
|||
}
|
||||
}
|
||||
|
||||
// Create a record
|
||||
// @Summary create userExample
|
||||
// @Description submit information to create userExample
|
||||
// Create a new userExample
|
||||
// @Summary create a new userExample
|
||||
// @Description Creates a new userExample entity using the provided data in the request body.
|
||||
// @Tags userExample
|
||||
// @accept json
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param data body types.CreateUserExampleRequest true "userExample information"
|
||||
// @Success 200 {object} types.CreateUserExampleReply{}
|
||||
|
@ -88,11 +88,11 @@ func (h *userExampleHandler) Create(c *gin.Context) {
|
|||
response.Success(c, gin.H{"id": userExample.ID})
|
||||
}
|
||||
|
||||
// DeleteByID delete a record by id
|
||||
// @Summary delete userExample
|
||||
// @Description delete userExample by id
|
||||
// DeleteByID delete a userExample by id
|
||||
// @Summary delete a userExample by id
|
||||
// @Description Deletes a existing userExample identified by the given id in the path.
|
||||
// @Tags userExample
|
||||
// @accept json
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param id path string true "id"
|
||||
// @Success 200 {object} types.DeleteUserExampleByIDReply{}
|
||||
|
@ -116,11 +116,11 @@ func (h *userExampleHandler) DeleteByID(c *gin.Context) {
|
|||
response.Success(c)
|
||||
}
|
||||
|
||||
// UpdateByID update information by id
|
||||
// @Summary update userExample
|
||||
// @Description update userExample information by id
|
||||
// UpdateByID update a userExample by id
|
||||
// @Summary update a userExample by id
|
||||
// @Description Updates the specified userExample by given id in the path, support partial update.
|
||||
// @Tags userExample
|
||||
// @accept json
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param id path string true "id"
|
||||
// @Param data body types.UpdateUserExampleByIDRequest true "userExample information"
|
||||
|
@ -162,9 +162,9 @@ func (h *userExampleHandler) UpdateByID(c *gin.Context) {
|
|||
response.Success(c)
|
||||
}
|
||||
|
||||
// GetByID get a record by id
|
||||
// @Summary get userExample detail
|
||||
// @Description get userExample detail by id
|
||||
// GetByID get userExample details by id
|
||||
// @Summary get userExample details by id
|
||||
// @Description Gets detailed information of a userExample specified by the given id in the path.
|
||||
// @Tags userExample
|
||||
// @Param id path string true "id"
|
||||
// @Accept json
|
||||
|
@ -203,11 +203,11 @@ func (h *userExampleHandler) GetByID(c *gin.Context) {
|
|||
response.Success(c, gin.H{"userExample": data})
|
||||
}
|
||||
|
||||
// List of records by query parameters
|
||||
// @Summary list of userExamples by query parameters
|
||||
// @Description list of userExamples by paging and conditions
|
||||
// List get a list of userExample by custom conditions
|
||||
// @Summary get a list of userExample by custom conditions
|
||||
// @Description Returns a paginated list of userExample based on query filters, including page number and size.
|
||||
// @Tags userExample
|
||||
// @accept json
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param data body types.Params true "query parameters"
|
||||
// @Success 200 {object} types.ListUserExamplesReply{}
|
||||
|
@ -242,9 +242,9 @@ func (h *userExampleHandler) List(c *gin.Context) {
|
|||
})
|
||||
}
|
||||
|
||||
// DeleteByIDs delete records by batch id
|
||||
// @Summary delete userExamples
|
||||
// @Description delete userExamples by batch id
|
||||
// DeleteByIDs delete userExample by batch id
|
||||
// @Summary delete userExample by batch id
|
||||
// @Description Deletes multiple userExample by a list of id
|
||||
// @Tags userExample
|
||||
// @Param data body types.DeleteUserExamplesByIDsRequest true "id array"
|
||||
// @Accept json
|
||||
|
@ -272,9 +272,9 @@ func (h *userExampleHandler) DeleteByIDs(c *gin.Context) {
|
|||
response.Success(c)
|
||||
}
|
||||
|
||||
// GetByCondition get a record by condition
|
||||
// @Summary get userExample by condition
|
||||
// @Description get userExample by condition
|
||||
// GetByCondition get userExample details by custom condition
|
||||
// @Summary get userExample details by custom condition
|
||||
// @Description Returns a single userExample that matches the specified filter conditions.
|
||||
// @Tags userExample
|
||||
// @Param data body types.Conditions true "query condition"
|
||||
// @Accept json
|
||||
|
@ -321,9 +321,9 @@ func (h *userExampleHandler) GetByCondition(c *gin.Context) {
|
|||
response.Success(c, gin.H{"userExample": data})
|
||||
}
|
||||
|
||||
// ListByIDs list of records by batch id
|
||||
// @Summary list of userExamples by batch id
|
||||
// @Description list of userExamples by batch id
|
||||
// ListByIDs get a list of userExample by batch id
|
||||
// @Summary get a list of userExample by batch id
|
||||
// @Description Returns a list of userExample that match the list of id.
|
||||
// @Tags userExample
|
||||
// @Param data body types.ListUserExamplesByIDsRequest true "id array"
|
||||
// @Accept json
|
||||
|
@ -365,11 +365,11 @@ func (h *userExampleHandler) ListByIDs(c *gin.Context) {
|
|||
})
|
||||
}
|
||||
|
||||
// ListByLastID get records by last id and limit
|
||||
// @Summary list of userExamples by last id and limit
|
||||
// @Description list of userExamples by last id and limit
|
||||
// ListByLastID get a list of userExample by last id
|
||||
// @Summary get a list of userExample by last id
|
||||
// @Description Returns a paginated list of userExamples starting after a given last id, useful for cursor-based pagination.
|
||||
// @Tags userExample
|
||||
// @accept json
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param lastID query int false "last id, default is MaxInt32" default(0)
|
||||
// @Param limit query int false "number per page" default(10)
|
||||
|
|
|
@ -50,11 +50,11 @@ func New{{.TableNameCamel}}Handler() {{.TableNameCamel}}Handler {
|
|||
}
|
||||
}
|
||||
|
||||
// Create a record
|
||||
// @Summary create {{.TableNameCamelFCL}}
|
||||
// @Description submit information to create {{.TableNameCamelFCL}}
|
||||
// Create a new {{.TableNameCamelFCL}}
|
||||
// @Summary create a new {{.TableNameCamelFCL}}
|
||||
// @Description Creates a new {{.TableNameCamelFCL}} entity using the provided data in the request body.
|
||||
// @Tags {{.TableNameCamelFCL}}
|
||||
// @accept json
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param data body types.Create{{.TableNameCamel}}Request true "{{.TableNameCamelFCL}} information"
|
||||
// @Success 200 {object} types.Create{{.TableNameCamel}}Reply{}
|
||||
|
@ -88,11 +88,11 @@ func (h *{{.TableNameCamelFCL}}Handler) Create(c *gin.Context) {
|
|||
response.Success(c, gin.H{"{{.ColumnNameCamelFCL}}": {{.TableNameCamelFCL}}.{{.ColumnNameCamel}}})
|
||||
}
|
||||
|
||||
// DeleteBy{{.ColumnNameCamel}} delete a record by {{.ColumnNameCamelFCL}}
|
||||
// @Summary delete {{.TableNameCamelFCL}}
|
||||
// @Description delete {{.TableNameCamelFCL}} by {{.ColumnNameCamelFCL}}
|
||||
// DeleteBy{{.ColumnNameCamel}} delete a {{.TableNameCamelFCL}} by {{.ColumnNameCamelFCL}}
|
||||
// @Summary delete a {{.TableNameCamelFCL}} by {{.ColumnNameCamelFCL}}
|
||||
// @Description Deletes a existing {{.TableNameCamelFCL}} identified by the given {{.ColumnNameCamelFCL}} in the path.
|
||||
// @Tags {{.TableNameCamelFCL}}
|
||||
// @accept json
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param {{.ColumnNameCamelFCL}} path string true "{{.ColumnNameCamelFCL}}"
|
||||
// @Success 200 {object} types.Delete{{.TableNameCamel}}By{{.ColumnNameCamel}}Reply{}
|
||||
|
@ -116,11 +116,11 @@ func (h *{{.TableNameCamelFCL}}Handler) DeleteBy{{.ColumnNameCamel}}(c *gin.Cont
|
|||
response.Success(c)
|
||||
}
|
||||
|
||||
// UpdateBy{{.ColumnNameCamel}} update information by {{.ColumnNameCamelFCL}}
|
||||
// @Summary update {{.TableNameCamelFCL}}
|
||||
// @Description update {{.TableNameCamelFCL}} information by {{.ColumnNameCamelFCL}}
|
||||
// UpdateBy{{.ColumnNameCamel}} update a {{.TableNameCamelFCL}} by {{.ColumnNameCamelFCL}}
|
||||
// @Summary update a {{.TableNameCamelFCL}} by {{.ColumnNameCamelFCL}}
|
||||
// @Description Updates the specified {{.TableNameCamelFCL}} by given {{.ColumnNameCamelFCL}} in the path, support partial update.
|
||||
// @Tags {{.TableNameCamelFCL}}
|
||||
// @accept json
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param {{.ColumnNameCamelFCL}} path string true "{{.ColumnNameCamelFCL}}"
|
||||
// @Param data body types.Update{{.TableNameCamel}}By{{.ColumnNameCamel}}Request true "{{.TableNameCamelFCL}} information"
|
||||
|
@ -162,9 +162,9 @@ func (h *{{.TableNameCamelFCL}}Handler) UpdateBy{{.ColumnNameCamel}}(c *gin.Cont
|
|||
response.Success(c)
|
||||
}
|
||||
|
||||
// GetBy{{.ColumnNameCamel}} get a record by {{.ColumnNameCamelFCL}}
|
||||
// @Summary get {{.TableNameCamelFCL}} detail
|
||||
// @Description get {{.TableNameCamelFCL}} detail by {{.ColumnNameCamelFCL}}
|
||||
// GetBy{{.ColumnNameCamel}} get {{.TableNameCamelFCL}} details by {{.ColumnNameCamelFCL}}
|
||||
// @Summary get {{.TableNameCamelFCL}} details by {{.ColumnNameCamelFCL}}
|
||||
// @Description Gets detailed information of a {{.TableNameCamelFCL}} specified by the given {{.ColumnNameCamelFCL}} in the path.
|
||||
// @Tags {{.TableNameCamelFCL}}
|
||||
// @Param {{.ColumnNameCamelFCL}} path string true "{{.ColumnNameCamelFCL}}"
|
||||
// @Accept json
|
||||
|
@ -203,11 +203,11 @@ func (h *{{.TableNameCamelFCL}}Handler) GetBy{{.ColumnNameCamel}}(c *gin.Context
|
|||
response.Success(c, gin.H{"{{.TableNameCamelFCL}}": data})
|
||||
}
|
||||
|
||||
// List of records by query parameters
|
||||
// @Summary list of {{.TableNamePluralCamelFCL}} by query parameters
|
||||
// @Description list of {{.TableNamePluralCamelFCL}} by paging and conditions
|
||||
// List get a list of {{.TableNamePluralCamelFCL}} by custom conditions
|
||||
// @Summary get a list of {{.TableNamePluralCamelFCL}} by custom conditions
|
||||
// @Description Returns a paginated list of {{.TableNamePluralCamelFCL}} based on query filters, including page number and size.
|
||||
// @Tags {{.TableNameCamelFCL}}
|
||||
// @accept json
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param data body types.Params true "query parameters"
|
||||
// @Success 200 {object} types.List{{.TableNamePluralCamel}}Reply{}
|
||||
|
@ -242,9 +242,9 @@ func (h *{{.TableNameCamelFCL}}Handler) List(c *gin.Context) {
|
|||
})
|
||||
}
|
||||
|
||||
// DeleteBy{{.ColumnNamePluralCamel}} delete records by batch {{.ColumnNameCamelFCL}}
|
||||
// @Summary delete {{.TableNamePluralCamelFCL}}
|
||||
// @Description delete {{.TableNamePluralCamelFCL}} by batch {{.ColumnNameCamelFCL}}
|
||||
// DeleteBy{{.ColumnNamePluralCamel}} delete {{.TableNamePluralCamelFCL}} by batch {{.ColumnNameCamelFCL}}
|
||||
// @Summary delete {{.TableNamePluralCamelFCL}} by batch {{.ColumnNameCamelFCL}}
|
||||
// @Description Deletes multiple {{.TableNamePluralCamelFCL}} by a list of {{.ColumnNameCamelFCL}}
|
||||
// @Tags {{.TableNameCamelFCL}}
|
||||
// @Param data body types.Delete{{.TableNamePluralCamel}}By{{.ColumnNamePluralCamel}}Request true "{{.ColumnNameCamelFCL}} array"
|
||||
// @Accept json
|
||||
|
@ -272,9 +272,9 @@ func (h *{{.TableNameCamelFCL}}Handler) DeleteBy{{.ColumnNamePluralCamel}}(c *gi
|
|||
response.Success(c)
|
||||
}
|
||||
|
||||
// GetByCondition get a record by condition
|
||||
// @Summary get {{.TableNameCamelFCL}} by condition
|
||||
// @Description get {{.TableNameCamelFCL}} by condition
|
||||
// GetByCondition get {{.TableNameCamelFCL}} details by custom condition
|
||||
// @Summary get {{.TableNameCamelFCL}} details by custom condition
|
||||
// @Description Returns a single {{.TableNameCamelFCL}} that matches the specified filter conditions.
|
||||
// @Tags {{.TableNameCamelFCL}}
|
||||
// @Param data body types.Conditions true "query condition"
|
||||
// @Accept json
|
||||
|
@ -321,9 +321,9 @@ func (h *{{.TableNameCamelFCL}}Handler) GetByCondition(c *gin.Context) {
|
|||
response.Success(c, gin.H{"{{.TableNameCamelFCL}}": data})
|
||||
}
|
||||
|
||||
// ListBy{{.ColumnNamePluralCamel}} list of records by batch {{.ColumnNameCamelFCL}}
|
||||
// @Summary list of {{.TableNamePluralCamelFCL}} by batch {{.ColumnNameCamelFCL}}
|
||||
// @Description list of {{.TableNamePluralCamelFCL}} by batch {{.ColumnNameCamelFCL}}
|
||||
// ListBy{{.ColumnNamePluralCamel}} get a list of {{.TableNamePluralCamelFCL}} by batch {{.ColumnNameCamelFCL}}
|
||||
// @Summary get a list of {{.TableNamePluralCamelFCL}} by batch {{.ColumnNameCamelFCL}}
|
||||
// @Description Returns a list of {{.TableNamePluralCamelFCL}} that match the list of {{.ColumnNameCamelFCL}}.
|
||||
// @Tags {{.TableNameCamelFCL}}
|
||||
// @Param data body types.List{{.TableNamePluralCamel}}By{{.ColumnNamePluralCamel}}Request true "{{.ColumnNameCamelFCL}} array"
|
||||
// @Accept json
|
||||
|
@ -365,11 +365,11 @@ func (h *{{.TableNameCamelFCL}}Handler) ListBy{{.ColumnNamePluralCamel}}(c *gin.
|
|||
})
|
||||
}
|
||||
|
||||
// ListByLast{{.ColumnNameCamel}} get records by last {{.ColumnNameCamelFCL}} and limit
|
||||
// @Summary list of {{.TableNamePluralCamelFCL}} by last {{.ColumnNameCamelFCL}} and limit
|
||||
// @Description list of {{.TableNamePluralCamelFCL}} by last {{.ColumnNameCamelFCL}} and limit
|
||||
// ListByLast{{.ColumnNameCamel}} get a list of {{.TableNamePluralCamelFCL}} by last {{.ColumnNameCamelFCL}}
|
||||
// @Summary get a list of {{.TableNamePluralCamelFCL}} by last {{.ColumnNameCamelFCL}}
|
||||
// @Description Returns a paginated list of {{.TableNamePluralCamelFCL}} starting after a given last {{.ColumnNameCamelFCL}}, useful for cursor-based pagination.
|
||||
// @Tags {{.TableNameCamelFCL}}
|
||||
// @accept json
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param last{{.ColumnNameCamel}} query {{if .IsStringType}}string{{else}}int{{end}} false "last {{.ColumnNameCamelFCL}}, default is {{if .IsStringType}}Max string {{.ColumnNameCamelFCL}}" default(){{else}}MaxInt32" default(0){{end}}
|
||||
// @Param limit query int false "number per page" default(10)
|
||||
|
|
|
@ -44,11 +44,11 @@ func NewUserExampleHandler() UserExampleHandler {
|
|||
}
|
||||
}
|
||||
|
||||
// Create a record
|
||||
// @Summary create userExample
|
||||
// @Description submit information to create userExample
|
||||
// Create a new userExample
|
||||
// @Summary create a new userExample
|
||||
// @Description Creates a new userExample entity using the provided data in the request body.
|
||||
// @Tags userExample
|
||||
// @accept json
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param data body types.CreateUserExampleRequest true "userExample information"
|
||||
// @Success 200 {object} types.CreateUserExampleReply{}
|
||||
|
@ -82,11 +82,11 @@ func (h *userExampleHandler) Create(c *gin.Context) {
|
|||
response.Success(c, gin.H{"id": userExample.ID})
|
||||
}
|
||||
|
||||
// DeleteByID delete a record by id
|
||||
// @Summary delete userExample
|
||||
// @Description delete userExample by id
|
||||
// DeleteByID delete a userExample by id
|
||||
// @Summary delete a userExample by id
|
||||
// @Description Deletes a existing userExample identified by the given id in the path.
|
||||
// @Tags userExample
|
||||
// @accept json
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param id path string true "id"
|
||||
// @Success 200 {object} types.DeleteUserExampleByIDReply{}
|
||||
|
@ -105,11 +105,11 @@ func (h *userExampleHandler) DeleteByID(c *gin.Context) {
|
|||
response.Success(c)
|
||||
}
|
||||
|
||||
// UpdateByID update information by id
|
||||
// @Summary update userExample
|
||||
// @Description update userExample information by id
|
||||
// UpdateByID update a userExample by id
|
||||
// @Summary update a userExample by id
|
||||
// @Description Updates the specified userExample by given id in the path, support partial update.
|
||||
// @Tags userExample
|
||||
// @accept json
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param id path string true "id"
|
||||
// @Param data body types.UpdateUserExampleByIDRequest true "userExample information"
|
||||
|
@ -151,9 +151,9 @@ func (h *userExampleHandler) UpdateByID(c *gin.Context) {
|
|||
response.Success(c)
|
||||
}
|
||||
|
||||
// GetByID get a record by id
|
||||
// @Summary get userExample detail
|
||||
// @Description get userExample detail by id
|
||||
// GetByID get userExample details by id
|
||||
// @Summary get userExample details by id
|
||||
// @Description Gets detailed information of a userExample specified by the given id in the path.
|
||||
// @Tags userExample
|
||||
// @Param id path string true "id"
|
||||
// @Accept json
|
||||
|
@ -188,11 +188,11 @@ func (h *userExampleHandler) GetByID(c *gin.Context) {
|
|||
response.Success(c, gin.H{"userExample": data})
|
||||
}
|
||||
|
||||
// List of records by query parameters
|
||||
// @Summary list of userExamples by query parameters
|
||||
// @Description list of userExamples by paging and conditions
|
||||
// List get a list of userExample by custom conditions
|
||||
// @Summary get a list of userExample by custom conditions
|
||||
// @Description Returns a paginated list of userExample based on query filters, including page number and size.
|
||||
// @Tags userExample
|
||||
// @accept json
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param data body types.Params true "query parameters"
|
||||
// @Success 200 {object} types.ListUserExamplesReply{}
|
||||
|
|
|
@ -50,11 +50,11 @@ func NewUserExampleHandler() UserExampleHandler {
|
|||
}
|
||||
}
|
||||
|
||||
// Create a record
|
||||
// @Summary create userExample
|
||||
// @Description submit information to create userExample
|
||||
// Create a new userExample
|
||||
// @Summary create a new userExample
|
||||
// @Description Creates a new userExample entity using the provided data in the request body.
|
||||
// @Tags userExample
|
||||
// @accept json
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param data body types.CreateUserExampleRequest true "userExample information"
|
||||
// @Success 200 {object} types.CreateUserExampleReply{}
|
||||
|
@ -88,11 +88,11 @@ func (h *userExampleHandler) Create(c *gin.Context) {
|
|||
response.Success(c, gin.H{"id": userExample.ID})
|
||||
}
|
||||
|
||||
// DeleteByID delete a record by id
|
||||
// @Summary delete userExample
|
||||
// @Description delete userExample by id
|
||||
// DeleteByID delete a userExample by id
|
||||
// @Summary delete a userExample by id
|
||||
// @Description Deletes a existing userExample identified by the given id in the path.
|
||||
// @Tags userExample
|
||||
// @accept json
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param id path string true "id"
|
||||
// @Success 200 {object} types.DeleteUserExampleByIDReply{}
|
||||
|
@ -111,11 +111,11 @@ func (h *userExampleHandler) DeleteByID(c *gin.Context) {
|
|||
response.Success(c)
|
||||
}
|
||||
|
||||
// UpdateByID update information by id
|
||||
// @Summary update userExample
|
||||
// @Description update userExample information by id
|
||||
// UpdateByID update a userExample by id
|
||||
// @Summary update a userExample by id
|
||||
// @Description Updates the specified userExample by given id in the path, support partial update.
|
||||
// @Tags userExample
|
||||
// @accept json
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param id path string true "id"
|
||||
// @Param data body types.UpdateUserExampleByIDRequest true "userExample information"
|
||||
|
@ -157,9 +157,9 @@ func (h *userExampleHandler) UpdateByID(c *gin.Context) {
|
|||
response.Success(c)
|
||||
}
|
||||
|
||||
// GetByID get a record by id
|
||||
// @Summary get userExample detail
|
||||
// @Description get userExample detail by id
|
||||
// GetByID get userExample details by id
|
||||
// @Summary get userExample details by id
|
||||
// @Description Gets detailed information of a userExample specified by the given id in the path.
|
||||
// @Tags userExample
|
||||
// @Param id path string true "id"
|
||||
// @Accept json
|
||||
|
@ -194,11 +194,11 @@ func (h *userExampleHandler) GetByID(c *gin.Context) {
|
|||
response.Success(c, gin.H{"userExample": data})
|
||||
}
|
||||
|
||||
// List of records by query parameters
|
||||
// @Summary list of userExamples by query parameters
|
||||
// @Description list of userExamples by paging and conditions
|
||||
// List get a list of userExample by custom conditions
|
||||
// @Summary get a list of userExample by custom conditions
|
||||
// @Description Returns a paginated list of userExample based on query filters, including page number and size.
|
||||
// @Tags userExample
|
||||
// @accept json
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param data body types.Params true "query parameters"
|
||||
// @Success 200 {object} types.ListUserExamplesReply{}
|
||||
|
@ -233,9 +233,9 @@ func (h *userExampleHandler) List(c *gin.Context) {
|
|||
})
|
||||
}
|
||||
|
||||
// DeleteByIDs delete records by batch id
|
||||
// @Summary delete userExamples
|
||||
// @Description delete userExamples by batch id
|
||||
// DeleteByIDs delete userExample by batch id
|
||||
// @Summary delete userExample by batch id
|
||||
// @Description Deletes multiple userExample by a list of id
|
||||
// @Tags userExample
|
||||
// @Param data body types.DeleteUserExamplesByIDsRequest true "id array"
|
||||
// @Accept json
|
||||
|
@ -263,9 +263,9 @@ func (h *userExampleHandler) DeleteByIDs(c *gin.Context) {
|
|||
response.Success(c)
|
||||
}
|
||||
|
||||
// GetByCondition get a record by condition
|
||||
// @Summary get userExample by condition
|
||||
// @Description get userExample by condition
|
||||
// GetByCondition get userExample details by custom condition
|
||||
// @Summary get userExample details by custom condition
|
||||
// @Description Returns a single userExample that matches the specified filter conditions.
|
||||
// @Tags userExample
|
||||
// @Param data body types.Conditions true "query condition"
|
||||
// @Accept json
|
||||
|
@ -313,9 +313,9 @@ func (h *userExampleHandler) GetByCondition(c *gin.Context) {
|
|||
response.Success(c, gin.H{"userExample": data})
|
||||
}
|
||||
|
||||
// ListByIDs list of records by batch id
|
||||
// @Summary list of userExamples by batch id
|
||||
// @Description list of userExamples by batch id
|
||||
// ListByIDs get a list of userExample by batch id
|
||||
// @Summary get a list of userExample by batch id
|
||||
// @Description Returns a list of userExample that match the list of id.
|
||||
// @Tags userExample
|
||||
// @Param data body types.ListUserExamplesByIDsRequest true "id array"
|
||||
// @Accept json
|
||||
|
@ -357,11 +357,11 @@ func (h *userExampleHandler) ListByIDs(c *gin.Context) {
|
|||
})
|
||||
}
|
||||
|
||||
// ListByLastID get records by last id and limit
|
||||
// @Summary list of userExamples by last id and limit
|
||||
// @Description list of userExamples by last id and limit
|
||||
// ListByLastID get a list of userExample by last id
|
||||
// @Summary get a list of userExample by last id
|
||||
// @Description Returns a paginated list of userExamples starting after a given last id, useful for cursor-based pagination.
|
||||
// @Tags userExample
|
||||
// @accept json
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param lastID query string false "last id, default()"
|
||||
// @Param limit query int false "size per page" default(10)
|
||||
|
|
|
@ -20,27 +20,27 @@ func NewUserExampleHandler() serverNameExampleV1.UserExampleLogicer {
|
|||
}
|
||||
}
|
||||
|
||||
// Create a record
|
||||
// Create a new userExample
|
||||
func (h *userExampleHandler) Create(ctx context.Context, req *serverNameExampleV1.CreateUserExampleRequest) (*serverNameExampleV1.CreateUserExampleReply, error) {
|
||||
return h.server.Create(ctx, req)
|
||||
}
|
||||
|
||||
// DeleteByID delete a record by id
|
||||
// DeleteByID delete a userExample by id
|
||||
func (h *userExampleHandler) DeleteByID(ctx context.Context, req *serverNameExampleV1.DeleteUserExampleByIDRequest) (*serverNameExampleV1.DeleteUserExampleByIDReply, error) {
|
||||
return h.server.DeleteByID(ctx, req)
|
||||
}
|
||||
|
||||
// UpdateByID update a record by id
|
||||
// UpdateByID update a userExample by id
|
||||
func (h *userExampleHandler) UpdateByID(ctx context.Context, req *serverNameExampleV1.UpdateUserExampleByIDRequest) (*serverNameExampleV1.UpdateUserExampleByIDReply, error) {
|
||||
return h.server.UpdateByID(ctx, req)
|
||||
}
|
||||
|
||||
// GetByID get a record by id
|
||||
// GetByID get userExample details by id
|
||||
func (h *userExampleHandler) GetByID(ctx context.Context, req *serverNameExampleV1.GetUserExampleByIDRequest) (*serverNameExampleV1.GetUserExampleByIDReply, error) {
|
||||
return h.server.GetByID(ctx, req)
|
||||
}
|
||||
|
||||
// List of records by query parameters
|
||||
// List get a list of userExample by custom conditions
|
||||
func (h *userExampleHandler) List(ctx context.Context, req *serverNameExampleV1.ListUserExampleRequest) (*serverNameExampleV1.ListUserExampleReply, error) {
|
||||
return h.server.List(ctx, req)
|
||||
}
|
||||
|
|
|
@ -20,47 +20,47 @@ func NewUserExampleHandler() serverNameExampleV1.UserExampleLogicer {
|
|||
}
|
||||
}
|
||||
|
||||
// Create a record
|
||||
// Create a new userExample
|
||||
func (h *userExampleHandler) Create(ctx context.Context, req *serverNameExampleV1.CreateUserExampleRequest) (*serverNameExampleV1.CreateUserExampleReply, error) {
|
||||
return h.server.Create(ctx, req)
|
||||
}
|
||||
|
||||
// DeleteByID delete a record by id
|
||||
// DeleteByID delete a userExample by id
|
||||
func (h *userExampleHandler) DeleteByID(ctx context.Context, req *serverNameExampleV1.DeleteUserExampleByIDRequest) (*serverNameExampleV1.DeleteUserExampleByIDReply, error) {
|
||||
return h.server.DeleteByID(ctx, req)
|
||||
}
|
||||
|
||||
// UpdateByID update a record by id
|
||||
// UpdateByID update a userExample by id
|
||||
func (h *userExampleHandler) UpdateByID(ctx context.Context, req *serverNameExampleV1.UpdateUserExampleByIDRequest) (*serverNameExampleV1.UpdateUserExampleByIDReply, error) {
|
||||
return h.server.UpdateByID(ctx, req)
|
||||
}
|
||||
|
||||
// GetByID get a record by id
|
||||
// GetByID get userExample details by id
|
||||
func (h *userExampleHandler) GetByID(ctx context.Context, req *serverNameExampleV1.GetUserExampleByIDRequest) (*serverNameExampleV1.GetUserExampleByIDReply, error) {
|
||||
return h.server.GetByID(ctx, req)
|
||||
}
|
||||
|
||||
// List of records by query parameters
|
||||
// List get a list of userExample by custom conditions
|
||||
func (h *userExampleHandler) List(ctx context.Context, req *serverNameExampleV1.ListUserExampleRequest) (*serverNameExampleV1.ListUserExampleReply, error) {
|
||||
return h.server.List(ctx, req)
|
||||
}
|
||||
|
||||
// DeleteByIDs delete records by batch id
|
||||
// DeleteByIDs delete userExample by batch id
|
||||
func (h *userExampleHandler) DeleteByIDs(ctx context.Context, req *serverNameExampleV1.DeleteUserExampleByIDsRequest) (*serverNameExampleV1.DeleteUserExampleByIDsReply, error) {
|
||||
return h.server.DeleteByIDs(ctx, req)
|
||||
}
|
||||
|
||||
// GetByCondition get a record by condition
|
||||
// GetByCondition get userExample details by custom condition
|
||||
func (h *userExampleHandler) GetByCondition(ctx context.Context, req *serverNameExampleV1.GetUserExampleByConditionRequest) (*serverNameExampleV1.GetUserExampleByConditionReply, error) {
|
||||
return h.server.GetByCondition(ctx, req)
|
||||
}
|
||||
|
||||
// ListByIDs list of records by batch id
|
||||
// ListByIDs get a list of userExample by batch id
|
||||
func (h *userExampleHandler) ListByIDs(ctx context.Context, req *serverNameExampleV1.ListUserExampleByIDsRequest) (*serverNameExampleV1.ListUserExampleByIDsReply, error) {
|
||||
return h.server.ListByIDs(ctx, req)
|
||||
}
|
||||
|
||||
// ListByLastID get records by last id
|
||||
// ListByLastID get a list of userExample by last id
|
||||
func (h *userExampleHandler) ListByLastID(ctx context.Context, req *serverNameExampleV1.ListUserExampleByLastIDRequest) (*serverNameExampleV1.ListUserExampleByLastIDReply, error) {
|
||||
return h.server.ListByLastID(ctx, req)
|
||||
}
|
||||
|
|
|
@ -20,47 +20,47 @@ func New{{.TableNameCamel}}Handler() serverNameExampleV1.{{.TableNameCamel}}Logi
|
|||
}
|
||||
}
|
||||
|
||||
// Create a record
|
||||
// Create a new {{.TableNameCamelFCL}}
|
||||
func (h *{{.TableNameCamelFCL}}Handler) Create(ctx context.Context, req *serverNameExampleV1.Create{{.TableNameCamel}}Request) (*serverNameExampleV1.Create{{.TableNameCamel}}Reply, error) {
|
||||
return h.server.Create(ctx, req)
|
||||
}
|
||||
|
||||
// DeleteBy{{.ColumnNameCamel}} delete a record by {{.ColumnNameCamelFCL}}
|
||||
// DeleteBy{{.ColumnNameCamel}} delete a {{.TableNameCamelFCL}} by {{.ColumnNameCamelFCL}}
|
||||
func (h *{{.TableNameCamelFCL}}Handler) DeleteBy{{.ColumnNameCamel}}(ctx context.Context, req *serverNameExampleV1.Delete{{.TableNameCamel}}By{{.ColumnNameCamel}}Request) (*serverNameExampleV1.Delete{{.TableNameCamel}}By{{.ColumnNameCamel}}Reply, error) {
|
||||
return h.server.DeleteBy{{.ColumnNameCamel}}(ctx, req)
|
||||
}
|
||||
|
||||
// UpdateBy{{.ColumnNameCamel}} update a record by {{.ColumnNameCamelFCL}}
|
||||
// UpdateBy{{.ColumnNameCamel}} update a {{.TableNameCamelFCL}} by {{.ColumnNameCamelFCL}}
|
||||
func (h *{{.TableNameCamelFCL}}Handler) UpdateBy{{.ColumnNameCamel}}(ctx context.Context, req *serverNameExampleV1.Update{{.TableNameCamel}}By{{.ColumnNameCamel}}Request) (*serverNameExampleV1.Update{{.TableNameCamel}}By{{.ColumnNameCamel}}Reply, error) {
|
||||
return h.server.UpdateBy{{.ColumnNameCamel}}(ctx, req)
|
||||
}
|
||||
|
||||
// GetBy{{.ColumnNameCamel}} get a record by {{.ColumnNameCamelFCL}}
|
||||
// GetBy{{.ColumnNameCamel}} get {{.TableNameCamelFCL}} details by {{.ColumnNameCamelFCL}}
|
||||
func (h *{{.TableNameCamelFCL}}Handler) GetBy{{.ColumnNameCamel}}(ctx context.Context, req *serverNameExampleV1.Get{{.TableNameCamel}}By{{.ColumnNameCamel}}Request) (*serverNameExampleV1.Get{{.TableNameCamel}}By{{.ColumnNameCamel}}Reply, error) {
|
||||
return h.server.GetBy{{.ColumnNameCamel}}(ctx, req)
|
||||
}
|
||||
|
||||
// List of records by query parameters
|
||||
// List get a list of {{.TableNameCamelFCL}} by custom conditions
|
||||
func (h *{{.TableNameCamelFCL}}Handler) List(ctx context.Context, req *serverNameExampleV1.List{{.TableNameCamel}}Request) (*serverNameExampleV1.List{{.TableNameCamel}}Reply, error) {
|
||||
return h.server.List(ctx, req)
|
||||
}
|
||||
|
||||
// DeleteBy{{.ColumnNamePluralCamel}} delete records by batch {{.ColumnNameCamelFCL}}
|
||||
// DeleteBy{{.ColumnNamePluralCamel}} delete {{.TableNameCamelFCL}} by batch {{.ColumnNameCamelFCL}}
|
||||
func (h *{{.TableNameCamelFCL}}Handler) DeleteBy{{.ColumnNamePluralCamel}}(ctx context.Context, req *serverNameExampleV1.Delete{{.TableNameCamel}}By{{.ColumnNamePluralCamel}}Request) (*serverNameExampleV1.Delete{{.TableNameCamel}}By{{.ColumnNamePluralCamel}}Reply, error) {
|
||||
return h.server.DeleteBy{{.ColumnNamePluralCamel}}(ctx, req)
|
||||
}
|
||||
|
||||
// GetByCondition get a record by condition
|
||||
// GetByCondition get {{.TableNameCamelFCL}} details by custom condition
|
||||
func (h *{{.TableNameCamelFCL}}Handler) GetByCondition(ctx context.Context, req *serverNameExampleV1.Get{{.TableNameCamel}}ByConditionRequest) (*serverNameExampleV1.Get{{.TableNameCamel}}ByConditionReply, error) {
|
||||
return h.server.GetByCondition(ctx, req)
|
||||
}
|
||||
|
||||
// ListBy{{.ColumnNamePluralCamel}} list of records by batch {{.ColumnNameCamelFCL}}
|
||||
// ListBy{{.ColumnNamePluralCamel}} get a list of {{.TableNameCamelFCL}} by batch {{.ColumnNameCamelFCL}}
|
||||
func (h *{{.TableNameCamelFCL}}Handler) ListBy{{.ColumnNamePluralCamel}}(ctx context.Context, req *serverNameExampleV1.List{{.TableNameCamel}}By{{.ColumnNamePluralCamel}}Request) (*serverNameExampleV1.List{{.TableNameCamel}}By{{.ColumnNamePluralCamel}}Reply, error) {
|
||||
return h.server.ListBy{{.ColumnNamePluralCamel}}(ctx, req)
|
||||
}
|
||||
|
||||
// ListByLast{{.ColumnNameCamel}} get records by last {{.ColumnNameCamelFCL}}
|
||||
// ListByLast{{.ColumnNameCamel}} get a list of {{.TableNameCamelFCL}} by last {{.ColumnNameCamelFCL}}
|
||||
func (h *{{.TableNameCamelFCL}}Handler) ListByLast{{.ColumnNameCamel}}(ctx context.Context, req *serverNameExampleV1.List{{.TableNameCamel}}ByLast{{.ColumnNameCamel}}Request) (*serverNameExampleV1.List{{.TableNameCamel}}ByLast{{.ColumnNameCamel}}Reply, error) {
|
||||
return h.server.ListByLast{{.ColumnNameCamel}}(ctx, req)
|
||||
}
|
||||
|
|
|
@ -20,27 +20,27 @@ func New{{.TableNameCamel}}Handler() serverNameExampleV1.{{.TableNameCamel}}Logi
|
|||
}
|
||||
}
|
||||
|
||||
// Create a record
|
||||
// Create a new {{.TableNameCamelFCL}}
|
||||
func (h *{{.TableNameCamelFCL}}Handler) Create(ctx context.Context, req *serverNameExampleV1.Create{{.TableNameCamel}}Request) (*serverNameExampleV1.Create{{.TableNameCamel}}Reply, error) {
|
||||
return h.server.Create(ctx, req)
|
||||
}
|
||||
|
||||
// DeleteBy{{.ColumnNameCamel}} delete a record by {{.ColumnNameCamelFCL}}
|
||||
// DeleteBy{{.ColumnNameCamel}} delete a {{.TableNameCamelFCL}} by {{.ColumnNameCamelFCL}}
|
||||
func (h *{{.TableNameCamelFCL}}Handler) DeleteBy{{.ColumnNameCamel}}(ctx context.Context, req *serverNameExampleV1.Delete{{.TableNameCamel}}By{{.ColumnNameCamel}}Request) (*serverNameExampleV1.Delete{{.TableNameCamel}}By{{.ColumnNameCamel}}Reply, error) {
|
||||
return h.server.DeleteBy{{.ColumnNameCamel}}(ctx, req)
|
||||
}
|
||||
|
||||
// UpdateBy{{.ColumnNameCamel}} update a record by {{.ColumnNameCamelFCL}}
|
||||
// UpdateBy{{.ColumnNameCamel}} update a {{.TableNameCamelFCL}} by {{.ColumnNameCamelFCL}}
|
||||
func (h *{{.TableNameCamelFCL}}Handler) UpdateBy{{.ColumnNameCamel}}(ctx context.Context, req *serverNameExampleV1.Update{{.TableNameCamel}}By{{.ColumnNameCamel}}Request) (*serverNameExampleV1.Update{{.TableNameCamel}}By{{.ColumnNameCamel}}Reply, error) {
|
||||
return h.server.UpdateBy{{.ColumnNameCamel}}(ctx, req)
|
||||
}
|
||||
|
||||
// GetBy{{.ColumnNameCamel}} get a record by {{.ColumnNameCamelFCL}}
|
||||
// GetBy{{.ColumnNameCamel}} get {{.TableNameCamelFCL}} details by {{.ColumnNameCamelFCL}}
|
||||
func (h *{{.TableNameCamelFCL}}Handler) GetBy{{.ColumnNameCamel}}(ctx context.Context, req *serverNameExampleV1.Get{{.TableNameCamel}}By{{.ColumnNameCamel}}Request) (*serverNameExampleV1.Get{{.TableNameCamel}}By{{.ColumnNameCamel}}Reply, error) {
|
||||
return h.server.GetBy{{.ColumnNameCamel}}(ctx, req)
|
||||
}
|
||||
|
||||
// List of records by query parameters
|
||||
// List get a list of {{.TableNameCamelFCL}} by custom conditions
|
||||
func (h *{{.TableNameCamelFCL}}Handler) List(ctx context.Context, req *serverNameExampleV1.List{{.TableNameCamel}}Request) (*serverNameExampleV1.List{{.TableNameCamel}}Reply, error) {
|
||||
return h.server.List(ctx, req)
|
||||
}
|
||||
|
|
|
@ -44,11 +44,11 @@ func New{{.TableNameCamel}}Handler() {{.TableNameCamel}}Handler {
|
|||
}
|
||||
}
|
||||
|
||||
// Create a record
|
||||
// @Summary create {{.TableNameCamelFCL}}
|
||||
// @Description submit information to create {{.TableNameCamelFCL}}
|
||||
// Create a new {{.TableNameCamelFCL}}
|
||||
// @Summary create a new {{.TableNameCamelFCL}}
|
||||
// @Description Creates a new {{.TableNameCamelFCL}} entity using the provided data in the request body.
|
||||
// @Tags {{.TableNameCamelFCL}}
|
||||
// @accept json
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param data body types.Create{{.TableNameCamel}}Request true "{{.TableNameCamelFCL}} information"
|
||||
// @Success 200 {object} types.Create{{.TableNameCamel}}Reply{}
|
||||
|
@ -82,11 +82,11 @@ func (h *{{.TableNameCamelFCL}}Handler) Create(c *gin.Context) {
|
|||
response.Success(c, gin.H{"{{.ColumnNameCamelFCL}}": {{.TableNameCamelFCL}}.{{.ColumnNameCamel}}})
|
||||
}
|
||||
|
||||
// DeleteBy{{.ColumnNameCamel}} delete a record by {{.ColumnNameCamelFCL}}
|
||||
// @Summary delete {{.TableNameCamelFCL}}
|
||||
// @Description delete {{.TableNameCamelFCL}} by {{.ColumnNameCamelFCL}}
|
||||
// DeleteBy{{.ColumnNameCamel}} delete a {{.TableNameCamelFCL}} by {{.ColumnNameCamelFCL}}
|
||||
// @Summary delete a {{.TableNameCamelFCL}} by {{.ColumnNameCamelFCL}}
|
||||
// @Description Deletes a existing {{.TableNameCamelFCL}} identified by the given {{.ColumnNameCamelFCL}} in the path.
|
||||
// @Tags {{.TableNameCamelFCL}}
|
||||
// @accept json
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param {{.ColumnNameCamelFCL}} path string true "{{.ColumnNameCamelFCL}}"
|
||||
// @Success 200 {object} types.Delete{{.TableNameCamel}}By{{.ColumnNameCamel}}Reply{}
|
||||
|
@ -110,11 +110,11 @@ func (h *{{.TableNameCamelFCL}}Handler) DeleteBy{{.ColumnNameCamel}}(c *gin.Cont
|
|||
response.Success(c)
|
||||
}
|
||||
|
||||
// UpdateBy{{.ColumnNameCamel}} update information by {{.ColumnNameCamelFCL}}
|
||||
// @Summary update {{.TableNameCamelFCL}}
|
||||
// @Description update {{.TableNameCamelFCL}} information by {{.ColumnNameCamelFCL}}
|
||||
// UpdateBy{{.ColumnNameCamel}} update a {{.TableNameCamelFCL}} by {{.ColumnNameCamelFCL}}
|
||||
// @Summary update a {{.TableNameCamelFCL}} by {{.ColumnNameCamelFCL}}
|
||||
// @Description Updates the specified {{.TableNameCamelFCL}} by given {{.ColumnNameCamelFCL}} in the path, support partial update.
|
||||
// @Tags {{.TableNameCamelFCL}}
|
||||
// @accept json
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param {{.ColumnNameCamelFCL}} path string true "{{.ColumnNameCamelFCL}}"
|
||||
// @Param data body types.Update{{.TableNameCamel}}By{{.ColumnNameCamel}}Request true "{{.TableNameCamelFCL}} information"
|
||||
|
@ -156,9 +156,9 @@ func (h *{{.TableNameCamelFCL}}Handler) UpdateBy{{.ColumnNameCamel}}(c *gin.Cont
|
|||
response.Success(c)
|
||||
}
|
||||
|
||||
// GetBy{{.ColumnNameCamel}} get a record by {{.ColumnNameCamelFCL}}
|
||||
// @Summary get {{.TableNameCamelFCL}} detail
|
||||
// @Description get {{.TableNameCamelFCL}} detail by {{.ColumnNameCamelFCL}}
|
||||
// GetBy{{.ColumnNameCamel}} get {{.TableNameCamelFCL}} details by {{.ColumnNameCamelFCL}}
|
||||
// @Summary get {{.TableNameCamelFCL}} details by {{.ColumnNameCamelFCL}}
|
||||
// @Description Gets detailed information of a {{.TableNameCamelFCL}} specified by the given {{.ColumnNameCamelFCL}} in the path.
|
||||
// @Tags {{.TableNameCamelFCL}}
|
||||
// @Param {{.ColumnNameCamelFCL}} path string true "{{.ColumnNameCamelFCL}}"
|
||||
// @Accept json
|
||||
|
@ -197,11 +197,11 @@ func (h *{{.TableNameCamelFCL}}Handler) GetBy{{.ColumnNameCamel}}(c *gin.Context
|
|||
response.Success(c, gin.H{"{{.TableNameCamelFCL}}": data})
|
||||
}
|
||||
|
||||
// List of records by query parameters
|
||||
// @Summary list of {{.TableNamePluralCamelFCL}} by query parameters
|
||||
// @Description list of {{.TableNamePluralCamelFCL}} by paging and conditions
|
||||
// List get a list of {{.TableNamePluralCamelFCL}} by custom conditions
|
||||
// @Summary get a list of {{.TableNamePluralCamelFCL}} by custom conditions
|
||||
// @Description Returns a paginated list of {{.TableNamePluralCamelFCL}} based on query filters, including page number and size.
|
||||
// @Tags {{.TableNameCamelFCL}}
|
||||
// @accept json
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param data body types.Params true "query parameters"
|
||||
// @Success 200 {object} types.List{{.TableNamePluralCamel}}Reply{}
|
||||
|
|
|
@ -36,7 +36,7 @@ func NewUserExamplePbHandler() serverNameExampleV1.UserExampleLogicer {
|
|||
}
|
||||
}
|
||||
|
||||
// Create a record
|
||||
// Create a new userExample
|
||||
func (h *userExamplePbHandler) Create(ctx context.Context, req *serverNameExampleV1.CreateUserExampleRequest) (*serverNameExampleV1.CreateUserExampleReply, error) {
|
||||
err := req.Validate()
|
||||
if err != nil {
|
||||
|
@ -60,7 +60,7 @@ func (h *userExamplePbHandler) Create(ctx context.Context, req *serverNameExampl
|
|||
return &serverNameExampleV1.CreateUserExampleReply{Id: userExample.ID}, nil
|
||||
}
|
||||
|
||||
// DeleteByID delete a record by id
|
||||
// DeleteByID delete a userExample by id
|
||||
func (h *userExamplePbHandler) DeleteByID(ctx context.Context, req *serverNameExampleV1.DeleteUserExampleByIDRequest) (*serverNameExampleV1.DeleteUserExampleByIDReply, error) {
|
||||
err := req.Validate()
|
||||
if err != nil {
|
||||
|
@ -77,7 +77,7 @@ func (h *userExamplePbHandler) DeleteByID(ctx context.Context, req *serverNameEx
|
|||
return &serverNameExampleV1.DeleteUserExampleByIDReply{}, nil
|
||||
}
|
||||
|
||||
// UpdateByID update a record by id
|
||||
// UpdateByID update a userExample by id
|
||||
func (h *userExamplePbHandler) UpdateByID(ctx context.Context, req *serverNameExampleV1.UpdateUserExampleByIDRequest) (*serverNameExampleV1.UpdateUserExampleByIDReply, error) {
|
||||
err := req.Validate()
|
||||
if err != nil {
|
||||
|
@ -102,7 +102,7 @@ func (h *userExamplePbHandler) UpdateByID(ctx context.Context, req *serverNameEx
|
|||
return &serverNameExampleV1.UpdateUserExampleByIDReply{}, nil
|
||||
}
|
||||
|
||||
// GetByID get a record by id
|
||||
// GetByID get userExample details by id
|
||||
func (h *userExamplePbHandler) GetByID(ctx context.Context, req *serverNameExampleV1.GetUserExampleByIDRequest) (*serverNameExampleV1.GetUserExampleByIDReply, error) {
|
||||
err := req.Validate()
|
||||
if err != nil {
|
||||
|
@ -131,7 +131,7 @@ func (h *userExamplePbHandler) GetByID(ctx context.Context, req *serverNameExamp
|
|||
}, nil
|
||||
}
|
||||
|
||||
// List of records by query parameters
|
||||
// List get a list of userExample by custom conditions
|
||||
func (h *userExamplePbHandler) List(ctx context.Context, req *serverNameExampleV1.ListUserExampleRequest) (*serverNameExampleV1.ListUserExampleReply, error) {
|
||||
err := req.Validate()
|
||||
if err != nil {
|
||||
|
|
|
@ -37,7 +37,7 @@ func NewUserExamplePbHandler() serverNameExampleV1.UserExampleLogicer {
|
|||
}
|
||||
}
|
||||
|
||||
// Create a record
|
||||
// Create a new userExample
|
||||
func (h *userExamplePbHandler) Create(ctx context.Context, req *serverNameExampleV1.CreateUserExampleRequest) (*serverNameExampleV1.CreateUserExampleReply, error) {
|
||||
err := req.Validate()
|
||||
if err != nil {
|
||||
|
@ -61,7 +61,7 @@ func (h *userExamplePbHandler) Create(ctx context.Context, req *serverNameExampl
|
|||
return &serverNameExampleV1.CreateUserExampleReply{Id: userExample.ID}, nil
|
||||
}
|
||||
|
||||
// DeleteByID delete a record by id
|
||||
// DeleteByID delete a userExample by id
|
||||
func (h *userExamplePbHandler) DeleteByID(ctx context.Context, req *serverNameExampleV1.DeleteUserExampleByIDRequest) (*serverNameExampleV1.DeleteUserExampleByIDReply, error) {
|
||||
err := req.Validate()
|
||||
if err != nil {
|
||||
|
@ -78,7 +78,7 @@ func (h *userExamplePbHandler) DeleteByID(ctx context.Context, req *serverNameEx
|
|||
return &serverNameExampleV1.DeleteUserExampleByIDReply{}, nil
|
||||
}
|
||||
|
||||
// UpdateByID update a record by id
|
||||
// UpdateByID update a userExample by id
|
||||
func (h *userExamplePbHandler) UpdateByID(ctx context.Context, req *serverNameExampleV1.UpdateUserExampleByIDRequest) (*serverNameExampleV1.UpdateUserExampleByIDReply, error) {
|
||||
err := req.Validate()
|
||||
if err != nil {
|
||||
|
@ -103,7 +103,7 @@ func (h *userExamplePbHandler) UpdateByID(ctx context.Context, req *serverNameEx
|
|||
return &serverNameExampleV1.UpdateUserExampleByIDReply{}, nil
|
||||
}
|
||||
|
||||
// GetByID get a record by id
|
||||
// GetByID get userExample details by id
|
||||
func (h *userExamplePbHandler) GetByID(ctx context.Context, req *serverNameExampleV1.GetUserExampleByIDRequest) (*serverNameExampleV1.GetUserExampleByIDReply, error) {
|
||||
err := req.Validate()
|
||||
if err != nil {
|
||||
|
@ -132,7 +132,7 @@ func (h *userExamplePbHandler) GetByID(ctx context.Context, req *serverNameExamp
|
|||
}, nil
|
||||
}
|
||||
|
||||
// List of records by query parameters
|
||||
// List get a list of userExample by custom conditions
|
||||
func (h *userExamplePbHandler) List(ctx context.Context, req *serverNameExampleV1.ListUserExampleRequest) (*serverNameExampleV1.ListUserExampleReply, error) {
|
||||
err := req.Validate()
|
||||
if err != nil {
|
||||
|
@ -173,7 +173,7 @@ func (h *userExamplePbHandler) List(ctx context.Context, req *serverNameExampleV
|
|||
}, nil
|
||||
}
|
||||
|
||||
// DeleteByIDs delete records by batch id
|
||||
// DeleteByIDs delete userExample by batch id
|
||||
func (h *userExamplePbHandler) DeleteByIDs(ctx context.Context, req *serverNameExampleV1.DeleteUserExampleByIDsRequest) (*serverNameExampleV1.DeleteUserExampleByIDsReply, error) {
|
||||
err := req.Validate()
|
||||
if err != nil {
|
||||
|
@ -190,7 +190,7 @@ func (h *userExamplePbHandler) DeleteByIDs(ctx context.Context, req *serverNameE
|
|||
return &serverNameExampleV1.DeleteUserExampleByIDsReply{}, nil
|
||||
}
|
||||
|
||||
// GetByCondition get a record by condition
|
||||
// GetByCondition get userExample details by custom condition
|
||||
func (h *userExamplePbHandler) GetByCondition(ctx context.Context, req *serverNameExampleV1.GetUserExampleByConditionRequest) (*serverNameExampleV1.GetUserExampleByConditionReply, error) {
|
||||
err := req.Validate()
|
||||
if err != nil {
|
||||
|
@ -231,7 +231,7 @@ func (h *userExamplePbHandler) GetByCondition(ctx context.Context, req *serverNa
|
|||
}, nil
|
||||
}
|
||||
|
||||
// ListByIDs list of records by batch id
|
||||
// ListByIDs get a list of userExample by batch id
|
||||
func (h *userExamplePbHandler) ListByIDs(ctx context.Context, req *serverNameExampleV1.ListUserExampleByIDsRequest) (*serverNameExampleV1.ListUserExampleByIDsReply, error) {
|
||||
err := req.Validate()
|
||||
if err != nil {
|
||||
|
@ -262,7 +262,7 @@ func (h *userExamplePbHandler) ListByIDs(ctx context.Context, req *serverNameExa
|
|||
}, nil
|
||||
}
|
||||
|
||||
// ListByLastID get records by last id
|
||||
// ListByLastID get a list of userExample by last id
|
||||
func (h *userExamplePbHandler) ListByLastID(ctx context.Context, req *serverNameExampleV1.ListUserExampleByLastIDRequest) (*serverNameExampleV1.ListUserExampleByLastIDReply, error) {
|
||||
err := req.Validate()
|
||||
if err != nil {
|
||||
|
|
|
@ -37,7 +37,7 @@ func New{{.TableNameCamel}}Handler() serverNameExampleV1.{{.TableNameCamel}}Logi
|
|||
}
|
||||
}
|
||||
|
||||
// Create a record
|
||||
// Create a new {{.TableNameCamelFCL}}
|
||||
func (h *{{.TableNameCamelFCL}}Handler) Create(ctx context.Context, req *serverNameExampleV1.Create{{.TableNameCamel}}Request) (*serverNameExampleV1.Create{{.TableNameCamel}}Reply, error) {
|
||||
err := req.Validate()
|
||||
if err != nil {
|
||||
|
@ -61,7 +61,7 @@ func (h *{{.TableNameCamelFCL}}Handler) Create(ctx context.Context, req *serverN
|
|||
return &serverNameExampleV1.Create{{.TableNameCamel}}Reply{ {{if .IsStandardPrimaryKey}}Id{{else}}{{.ColumnNameCamel}}{{end}}: {{.TableNameCamelFCL}}.{{.ColumnNameCamel}} }, nil
|
||||
}
|
||||
|
||||
// DeleteBy{{.ColumnNameCamel}} delete a record by {{.ColumnNameCamelFCL}}
|
||||
// DeleteBy{{.ColumnNameCamel}} delete a {{.TableNameCamelFCL}} by {{.ColumnNameCamelFCL}}
|
||||
func (h *{{.TableNameCamelFCL}}Handler) DeleteBy{{.ColumnNameCamel}}(ctx context.Context, req *serverNameExampleV1.Delete{{.TableNameCamel}}By{{.ColumnNameCamel}}Request) (*serverNameExampleV1.Delete{{.TableNameCamel}}By{{.ColumnNameCamel}}Reply, error) {
|
||||
err := req.Validate()
|
||||
if err != nil {
|
||||
|
@ -78,7 +78,7 @@ func (h *{{.TableNameCamelFCL}}Handler) DeleteBy{{.ColumnNameCamel}}(ctx context
|
|||
return &serverNameExampleV1.Delete{{.TableNameCamel}}By{{.ColumnNameCamel}}Reply{}, nil
|
||||
}
|
||||
|
||||
// UpdateBy{{.ColumnNameCamel}} update a record by {{.ColumnNameCamelFCL}}
|
||||
// UpdateBy{{.ColumnNameCamel}} update a {{.TableNameCamelFCL}} by {{.ColumnNameCamelFCL}}
|
||||
func (h *{{.TableNameCamelFCL}}Handler) UpdateBy{{.ColumnNameCamel}}(ctx context.Context, req *serverNameExampleV1.Update{{.TableNameCamel}}By{{.ColumnNameCamel}}Request) (*serverNameExampleV1.Update{{.TableNameCamel}}By{{.ColumnNameCamel}}Reply, error) {
|
||||
err := req.Validate()
|
||||
if err != nil {
|
||||
|
@ -103,7 +103,7 @@ func (h *{{.TableNameCamelFCL}}Handler) UpdateBy{{.ColumnNameCamel}}(ctx context
|
|||
return &serverNameExampleV1.Update{{.TableNameCamel}}By{{.ColumnNameCamel}}Reply{}, nil
|
||||
}
|
||||
|
||||
// GetBy{{.ColumnNameCamel}} get a record by {{.ColumnNameCamelFCL}}
|
||||
// GetBy{{.ColumnNameCamel}} get {{.TableNameCamelFCL}} details by {{.ColumnNameCamelFCL}}
|
||||
func (h *{{.TableNameCamelFCL}}Handler) GetBy{{.ColumnNameCamel}}(ctx context.Context, req *serverNameExampleV1.Get{{.TableNameCamel}}By{{.ColumnNameCamel}}Request) (*serverNameExampleV1.Get{{.TableNameCamel}}By{{.ColumnNameCamel}}Reply, error) {
|
||||
err := req.Validate()
|
||||
if err != nil {
|
||||
|
@ -132,7 +132,7 @@ func (h *{{.TableNameCamelFCL}}Handler) GetBy{{.ColumnNameCamel}}(ctx context.Co
|
|||
}, nil
|
||||
}
|
||||
|
||||
// List of records by query parameters
|
||||
// List get a list of {{.TableNameCamelFCL}} by custom conditions
|
||||
func (h *{{.TableNameCamelFCL}}Handler) List(ctx context.Context, req *serverNameExampleV1.List{{.TableNameCamel}}Request) (*serverNameExampleV1.List{{.TableNameCamel}}Reply, error) {
|
||||
err := req.Validate()
|
||||
if err != nil {
|
||||
|
@ -173,7 +173,7 @@ func (h *{{.TableNameCamelFCL}}Handler) List(ctx context.Context, req *serverNam
|
|||
}, nil
|
||||
}
|
||||
|
||||
// DeleteBy{{.ColumnNamePluralCamel}} delete records by batch {{.ColumnNameCamelFCL}}
|
||||
// DeleteBy{{.ColumnNamePluralCamel}} delete {{.TableNameCamelFCL}} by batch {{.ColumnNameCamelFCL}}
|
||||
func (h *{{.TableNameCamelFCL}}Handler) DeleteBy{{.ColumnNamePluralCamel}}(ctx context.Context, req *serverNameExampleV1.Delete{{.TableNameCamel}}By{{.ColumnNamePluralCamel}}Request) (*serverNameExampleV1.Delete{{.TableNameCamel}}By{{.ColumnNamePluralCamel}}Reply, error) {
|
||||
err := req.Validate()
|
||||
if err != nil {
|
||||
|
@ -190,7 +190,7 @@ func (h *{{.TableNameCamelFCL}}Handler) DeleteBy{{.ColumnNamePluralCamel}}(ctx c
|
|||
return &serverNameExampleV1.Delete{{.TableNameCamel}}By{{.ColumnNamePluralCamel}}Reply{}, nil
|
||||
}
|
||||
|
||||
// GetByCondition get a record by condition
|
||||
// GetByCondition get {{.TableNameCamelFCL}} details by custom condition
|
||||
func (h *{{.TableNameCamelFCL}}Handler) GetByCondition(ctx context.Context, req *serverNameExampleV1.Get{{.TableNameCamel}}ByConditionRequest) (*serverNameExampleV1.Get{{.TableNameCamel}}ByConditionReply, error) {
|
||||
err := req.Validate()
|
||||
if err != nil {
|
||||
|
@ -231,7 +231,7 @@ func (h *{{.TableNameCamelFCL}}Handler) GetByCondition(ctx context.Context, req
|
|||
}, nil
|
||||
}
|
||||
|
||||
// ListBy{{.ColumnNamePluralCamel}} list of records by batch {{.ColumnNameCamelFCL}}
|
||||
// ListBy{{.ColumnNamePluralCamel}} get a list of {{.TableNameCamelFCL}} by batch {{.ColumnNameCamelFCL}}
|
||||
func (h *{{.TableNameCamelFCL}}Handler) ListBy{{.ColumnNamePluralCamel}}(ctx context.Context, req *serverNameExampleV1.List{{.TableNameCamel}}By{{.ColumnNamePluralCamel}}Request) (*serverNameExampleV1.List{{.TableNameCamel}}By{{.ColumnNamePluralCamel}}Reply, error) {
|
||||
err := req.Validate()
|
||||
if err != nil {
|
||||
|
@ -262,7 +262,7 @@ func (h *{{.TableNameCamelFCL}}Handler) ListBy{{.ColumnNamePluralCamel}}(ctx con
|
|||
}, nil
|
||||
}
|
||||
|
||||
// ListByLast{{.ColumnNameCamel}} get records by last {{.ColumnNameCamelFCL}}
|
||||
// ListByLast{{.ColumnNameCamel}} get a list of {{.TableNameCamelFCL}} by last {{.ColumnNameCamelFCL}}
|
||||
func (h *{{.TableNameCamelFCL}}Handler) ListByLast{{.ColumnNameCamel}}(ctx context.Context, req *serverNameExampleV1.List{{.TableNameCamel}}ByLast{{.ColumnNameCamel}}Request) (*serverNameExampleV1.List{{.TableNameCamel}}ByLast{{.ColumnNameCamel}}Reply, error) {
|
||||
err := req.Validate()
|
||||
if err != nil {
|
||||
|
|
|
@ -37,7 +37,7 @@ func NewUserExamplePbHandler() serverNameExampleV1.UserExampleLogicer {
|
|||
}
|
||||
}
|
||||
|
||||
// Create a record
|
||||
// Create a new userExample
|
||||
func (h *userExamplePbHandler) Create(ctx context.Context, req *serverNameExampleV1.CreateUserExampleRequest) (*serverNameExampleV1.CreateUserExampleReply, error) {
|
||||
err := req.Validate()
|
||||
if err != nil {
|
||||
|
@ -61,7 +61,7 @@ func (h *userExamplePbHandler) Create(ctx context.Context, req *serverNameExampl
|
|||
return &serverNameExampleV1.CreateUserExampleReply{Id: userExample.ID.Hex()}, nil
|
||||
}
|
||||
|
||||
// DeleteByID delete a record by id
|
||||
// DeleteByID delete a userExample by id
|
||||
func (h *userExamplePbHandler) DeleteByID(ctx context.Context, req *serverNameExampleV1.DeleteUserExampleByIDRequest) (*serverNameExampleV1.DeleteUserExampleByIDReply, error) {
|
||||
err := req.Validate()
|
||||
if err != nil {
|
||||
|
@ -78,7 +78,7 @@ func (h *userExamplePbHandler) DeleteByID(ctx context.Context, req *serverNameEx
|
|||
return &serverNameExampleV1.DeleteUserExampleByIDReply{}, nil
|
||||
}
|
||||
|
||||
// UpdateByID update a record by id
|
||||
// UpdateByID update a userExample by id
|
||||
func (h *userExamplePbHandler) UpdateByID(ctx context.Context, req *serverNameExampleV1.UpdateUserExampleByIDRequest) (*serverNameExampleV1.UpdateUserExampleByIDReply, error) {
|
||||
err := req.Validate()
|
||||
if err != nil {
|
||||
|
@ -103,7 +103,7 @@ func (h *userExamplePbHandler) UpdateByID(ctx context.Context, req *serverNameEx
|
|||
return &serverNameExampleV1.UpdateUserExampleByIDReply{}, nil
|
||||
}
|
||||
|
||||
// GetByID get a record by id
|
||||
// GetByID get userExample details by id
|
||||
func (h *userExamplePbHandler) GetByID(ctx context.Context, req *serverNameExampleV1.GetUserExampleByIDRequest) (*serverNameExampleV1.GetUserExampleByIDReply, error) {
|
||||
err := req.Validate()
|
||||
if err != nil {
|
||||
|
@ -132,7 +132,7 @@ func (h *userExamplePbHandler) GetByID(ctx context.Context, req *serverNameExamp
|
|||
}, nil
|
||||
}
|
||||
|
||||
// List of records by query parameters
|
||||
// List get a list of userExample by custom conditions
|
||||
func (h *userExamplePbHandler) List(ctx context.Context, req *serverNameExampleV1.ListUserExampleRequest) (*serverNameExampleV1.ListUserExampleReply, error) {
|
||||
err := req.Validate()
|
||||
if err != nil {
|
||||
|
|
|
@ -37,7 +37,7 @@ func NewUserExamplePbHandler() serverNameExampleV1.UserExampleLogicer {
|
|||
}
|
||||
}
|
||||
|
||||
// Create a record
|
||||
// Create a new userExample
|
||||
func (h *userExamplePbHandler) Create(ctx context.Context, req *serverNameExampleV1.CreateUserExampleRequest) (*serverNameExampleV1.CreateUserExampleReply, error) {
|
||||
err := req.Validate()
|
||||
if err != nil {
|
||||
|
@ -61,7 +61,7 @@ func (h *userExamplePbHandler) Create(ctx context.Context, req *serverNameExampl
|
|||
return &serverNameExampleV1.CreateUserExampleReply{Id: userExample.ID.Hex()}, nil
|
||||
}
|
||||
|
||||
// DeleteByID delete a record by id
|
||||
// DeleteByID delete a userExample by id
|
||||
func (h *userExamplePbHandler) DeleteByID(ctx context.Context, req *serverNameExampleV1.DeleteUserExampleByIDRequest) (*serverNameExampleV1.DeleteUserExampleByIDReply, error) {
|
||||
err := req.Validate()
|
||||
if err != nil {
|
||||
|
@ -78,7 +78,7 @@ func (h *userExamplePbHandler) DeleteByID(ctx context.Context, req *serverNameEx
|
|||
return &serverNameExampleV1.DeleteUserExampleByIDReply{}, nil
|
||||
}
|
||||
|
||||
// UpdateByID update a record by id
|
||||
// UpdateByID update a userExample by id
|
||||
func (h *userExamplePbHandler) UpdateByID(ctx context.Context, req *serverNameExampleV1.UpdateUserExampleByIDRequest) (*serverNameExampleV1.UpdateUserExampleByIDReply, error) {
|
||||
err := req.Validate()
|
||||
if err != nil {
|
||||
|
@ -103,7 +103,7 @@ func (h *userExamplePbHandler) UpdateByID(ctx context.Context, req *serverNameEx
|
|||
return &serverNameExampleV1.UpdateUserExampleByIDReply{}, nil
|
||||
}
|
||||
|
||||
// GetByID get a record by id
|
||||
// GetByID get userExample details by id
|
||||
func (h *userExamplePbHandler) GetByID(ctx context.Context, req *serverNameExampleV1.GetUserExampleByIDRequest) (*serverNameExampleV1.GetUserExampleByIDReply, error) {
|
||||
err := req.Validate()
|
||||
if err != nil {
|
||||
|
@ -132,7 +132,7 @@ func (h *userExamplePbHandler) GetByID(ctx context.Context, req *serverNameExamp
|
|||
}, nil
|
||||
}
|
||||
|
||||
// List of records by query parameters
|
||||
// List get a list of userExample by custom conditions
|
||||
func (h *userExamplePbHandler) List(ctx context.Context, req *serverNameExampleV1.ListUserExampleRequest) (*serverNameExampleV1.ListUserExampleReply, error) {
|
||||
err := req.Validate()
|
||||
if err != nil {
|
||||
|
@ -173,7 +173,7 @@ func (h *userExamplePbHandler) List(ctx context.Context, req *serverNameExampleV
|
|||
}, nil
|
||||
}
|
||||
|
||||
// DeleteByIDs delete records by batch id
|
||||
// DeleteByIDs delete userExample by batch id
|
||||
func (h *userExamplePbHandler) DeleteByIDs(ctx context.Context, req *serverNameExampleV1.DeleteUserExampleByIDsRequest) (*serverNameExampleV1.DeleteUserExampleByIDsReply, error) {
|
||||
err := req.Validate()
|
||||
if err != nil {
|
||||
|
@ -190,7 +190,7 @@ func (h *userExamplePbHandler) DeleteByIDs(ctx context.Context, req *serverNameE
|
|||
return &serverNameExampleV1.DeleteUserExampleByIDsReply{}, nil
|
||||
}
|
||||
|
||||
// GetByCondition get a record by condition
|
||||
// GetByCondition get userExample details by custom condition
|
||||
func (h *userExamplePbHandler) GetByCondition(ctx context.Context, req *serverNameExampleV1.GetUserExampleByConditionRequest) (*serverNameExampleV1.GetUserExampleByConditionReply, error) {
|
||||
err := req.Validate()
|
||||
if err != nil {
|
||||
|
@ -231,7 +231,7 @@ func (h *userExamplePbHandler) GetByCondition(ctx context.Context, req *serverNa
|
|||
}, nil
|
||||
}
|
||||
|
||||
// ListByIDs list of records by batch id
|
||||
// ListByIDs get a list of userExample by batch id
|
||||
func (h *userExamplePbHandler) ListByIDs(ctx context.Context, req *serverNameExampleV1.ListUserExampleByIDsRequest) (*serverNameExampleV1.ListUserExampleByIDsReply, error) {
|
||||
err := req.Validate()
|
||||
if err != nil {
|
||||
|
@ -262,7 +262,7 @@ func (h *userExamplePbHandler) ListByIDs(ctx context.Context, req *serverNameExa
|
|||
}, nil
|
||||
}
|
||||
|
||||
// ListByLastID get records by last id
|
||||
// ListByLastID get a list of userExample by last id
|
||||
func (h *userExamplePbHandler) ListByLastID(ctx context.Context, req *serverNameExampleV1.ListUserExampleByLastIDRequest) (*serverNameExampleV1.ListUserExampleByLastIDReply, error) {
|
||||
err := req.Validate()
|
||||
if err != nil {
|
||||
|
|
|
@ -36,7 +36,7 @@ func New{{.TableNameCamel}}Handler() serverNameExampleV1.{{.TableNameCamel}}Logi
|
|||
}
|
||||
}
|
||||
|
||||
// Create a record
|
||||
// Create a new {{.TableNameCamelFCL}}
|
||||
func (h *{{.TableNameCamelFCL}}Handler) Create(ctx context.Context, req *serverNameExampleV1.Create{{.TableNameCamel}}Request) (*serverNameExampleV1.Create{{.TableNameCamel}}Reply, error) {
|
||||
err := req.Validate()
|
||||
if err != nil {
|
||||
|
@ -60,7 +60,7 @@ func (h *{{.TableNameCamelFCL}}Handler) Create(ctx context.Context, req *serverN
|
|||
return &serverNameExampleV1.Create{{.TableNameCamel}}Reply{ {{if .IsStandardPrimaryKey}}Id{{else}}{{.ColumnNameCamel}}{{end}}: {{.TableNameCamelFCL}}.{{.ColumnNameCamel}} }, nil
|
||||
}
|
||||
|
||||
// DeleteBy{{.ColumnNameCamel}} delete a record by {{.ColumnNameCamelFCL}}
|
||||
// DeleteBy{{.ColumnNameCamel}} delete a {{.TableNameCamelFCL}} by {{.ColumnNameCamelFCL}}
|
||||
func (h *{{.TableNameCamelFCL}}Handler) DeleteBy{{.ColumnNameCamel}}(ctx context.Context, req *serverNameExampleV1.Delete{{.TableNameCamel}}By{{.ColumnNameCamel}}Request) (*serverNameExampleV1.Delete{{.TableNameCamel}}By{{.ColumnNameCamel}}Reply, error) {
|
||||
err := req.Validate()
|
||||
if err != nil {
|
||||
|
@ -77,7 +77,7 @@ func (h *{{.TableNameCamelFCL}}Handler) DeleteBy{{.ColumnNameCamel}}(ctx context
|
|||
return &serverNameExampleV1.Delete{{.TableNameCamel}}By{{.ColumnNameCamel}}Reply{}, nil
|
||||
}
|
||||
|
||||
// UpdateBy{{.ColumnNameCamel}} update a record by {{.ColumnNameCamelFCL}}
|
||||
// UpdateBy{{.ColumnNameCamel}} update a {{.TableNameCamelFCL}} by {{.ColumnNameCamelFCL}}
|
||||
func (h *{{.TableNameCamelFCL}}Handler) UpdateBy{{.ColumnNameCamel}}(ctx context.Context, req *serverNameExampleV1.Update{{.TableNameCamel}}By{{.ColumnNameCamel}}Request) (*serverNameExampleV1.Update{{.TableNameCamel}}By{{.ColumnNameCamel}}Reply, error) {
|
||||
err := req.Validate()
|
||||
if err != nil {
|
||||
|
@ -102,7 +102,7 @@ func (h *{{.TableNameCamelFCL}}Handler) UpdateBy{{.ColumnNameCamel}}(ctx context
|
|||
return &serverNameExampleV1.Update{{.TableNameCamel}}By{{.ColumnNameCamel}}Reply{}, nil
|
||||
}
|
||||
|
||||
// GetBy{{.ColumnNameCamel}} get a record by {{.ColumnNameCamelFCL}}
|
||||
// GetBy{{.ColumnNameCamel}} get {{.TableNameCamelFCL}} details by {{.ColumnNameCamelFCL}}
|
||||
func (h *{{.TableNameCamelFCL}}Handler) GetBy{{.ColumnNameCamel}}(ctx context.Context, req *serverNameExampleV1.Get{{.TableNameCamel}}By{{.ColumnNameCamel}}Request) (*serverNameExampleV1.Get{{.TableNameCamel}}By{{.ColumnNameCamel}}Reply, error) {
|
||||
err := req.Validate()
|
||||
if err != nil {
|
||||
|
@ -131,7 +131,7 @@ func (h *{{.TableNameCamelFCL}}Handler) GetBy{{.ColumnNameCamel}}(ctx context.Co
|
|||
}, nil
|
||||
}
|
||||
|
||||
// List of records by query parameters
|
||||
// List get a list of {{.TableNameCamelFCL}} by custom conditions
|
||||
func (h *{{.TableNameCamelFCL}}Handler) List(ctx context.Context, req *serverNameExampleV1.List{{.TableNameCamel}}Request) (*serverNameExampleV1.List{{.TableNameCamel}}Reply, error) {
|
||||
err := req.Validate()
|
||||
if err != nil {
|
||||
|
|
|
@ -46,7 +46,7 @@ func NewUserExampleServer() serverNameExampleV1.UserExampleServer {
|
|||
}
|
||||
}
|
||||
|
||||
// Create a record
|
||||
// Create a new userExample
|
||||
func (s *userExample) Create(ctx context.Context, req *serverNameExampleV1.CreateUserExampleRequest) (*serverNameExampleV1.CreateUserExampleReply, error) {
|
||||
err := req.Validate()
|
||||
if err != nil {
|
||||
|
@ -71,7 +71,7 @@ func (s *userExample) Create(ctx context.Context, req *serverNameExampleV1.Creat
|
|||
return &serverNameExampleV1.CreateUserExampleReply{Id: record.ID}, nil
|
||||
}
|
||||
|
||||
// DeleteByID delete a record by id
|
||||
// DeleteByID delete a userExample by id
|
||||
func (s *userExample) DeleteByID(ctx context.Context, req *serverNameExampleV1.DeleteUserExampleByIDRequest) (*serverNameExampleV1.DeleteUserExampleByIDReply, error) {
|
||||
err := req.Validate()
|
||||
if err != nil {
|
||||
|
@ -89,7 +89,7 @@ func (s *userExample) DeleteByID(ctx context.Context, req *serverNameExampleV1.D
|
|||
return &serverNameExampleV1.DeleteUserExampleByIDReply{}, nil
|
||||
}
|
||||
|
||||
// UpdateByID update a record by id
|
||||
// UpdateByID update a userExample by id
|
||||
func (s *userExample) UpdateByID(ctx context.Context, req *serverNameExampleV1.UpdateUserExampleByIDRequest) (*serverNameExampleV1.UpdateUserExampleByIDReply, error) {
|
||||
err := req.Validate()
|
||||
if err != nil {
|
||||
|
@ -115,7 +115,7 @@ func (s *userExample) UpdateByID(ctx context.Context, req *serverNameExampleV1.U
|
|||
return &serverNameExampleV1.UpdateUserExampleByIDReply{}, nil
|
||||
}
|
||||
|
||||
// GetByID get a record by id
|
||||
// GetByID get userExample details by id
|
||||
func (s *userExample) GetByID(ctx context.Context, req *serverNameExampleV1.GetUserExampleByIDRequest) (*serverNameExampleV1.GetUserExampleByIDReply, error) {
|
||||
err := req.Validate()
|
||||
if err != nil {
|
||||
|
@ -143,7 +143,7 @@ func (s *userExample) GetByID(ctx context.Context, req *serverNameExampleV1.GetU
|
|||
return &serverNameExampleV1.GetUserExampleByIDReply{UserExample: data}, nil
|
||||
}
|
||||
|
||||
// List of records by query parameters
|
||||
// List get a list of userExample by custom conditions
|
||||
func (s *userExample) List(ctx context.Context, req *serverNameExampleV1.ListUserExampleRequest) (*serverNameExampleV1.ListUserExampleReply, error) {
|
||||
err := req.Validate()
|
||||
if err != nil {
|
||||
|
|
|
@ -47,7 +47,7 @@ func NewUserExampleServer() serverNameExampleV1.UserExampleServer {
|
|||
}
|
||||
}
|
||||
|
||||
// Create a record
|
||||
// Create a new userExample
|
||||
func (s *userExample) Create(ctx context.Context, req *serverNameExampleV1.CreateUserExampleRequest) (*serverNameExampleV1.CreateUserExampleReply, error) {
|
||||
err := req.Validate()
|
||||
if err != nil {
|
||||
|
@ -72,7 +72,7 @@ func (s *userExample) Create(ctx context.Context, req *serverNameExampleV1.Creat
|
|||
return &serverNameExampleV1.CreateUserExampleReply{Id: record.ID}, nil
|
||||
}
|
||||
|
||||
// DeleteByID delete a record by id
|
||||
// DeleteByID delete a userExample by id
|
||||
func (s *userExample) DeleteByID(ctx context.Context, req *serverNameExampleV1.DeleteUserExampleByIDRequest) (*serverNameExampleV1.DeleteUserExampleByIDReply, error) {
|
||||
err := req.Validate()
|
||||
if err != nil {
|
||||
|
@ -90,7 +90,7 @@ func (s *userExample) DeleteByID(ctx context.Context, req *serverNameExampleV1.D
|
|||
return &serverNameExampleV1.DeleteUserExampleByIDReply{}, nil
|
||||
}
|
||||
|
||||
// UpdateByID update a record by id
|
||||
// UpdateByID update a userExample by id
|
||||
func (s *userExample) UpdateByID(ctx context.Context, req *serverNameExampleV1.UpdateUserExampleByIDRequest) (*serverNameExampleV1.UpdateUserExampleByIDReply, error) {
|
||||
err := req.Validate()
|
||||
if err != nil {
|
||||
|
@ -116,7 +116,7 @@ func (s *userExample) UpdateByID(ctx context.Context, req *serverNameExampleV1.U
|
|||
return &serverNameExampleV1.UpdateUserExampleByIDReply{}, nil
|
||||
}
|
||||
|
||||
// GetByID get a record by id
|
||||
// GetByID get userExample details by id
|
||||
func (s *userExample) GetByID(ctx context.Context, req *serverNameExampleV1.GetUserExampleByIDRequest) (*serverNameExampleV1.GetUserExampleByIDReply, error) {
|
||||
err := req.Validate()
|
||||
if err != nil {
|
||||
|
@ -144,7 +144,7 @@ func (s *userExample) GetByID(ctx context.Context, req *serverNameExampleV1.GetU
|
|||
return &serverNameExampleV1.GetUserExampleByIDReply{UserExample: data}, nil
|
||||
}
|
||||
|
||||
// List of records by query parameters
|
||||
// List get a list of userExample by custom conditions
|
||||
func (s *userExample) List(ctx context.Context, req *serverNameExampleV1.ListUserExampleRequest) (*serverNameExampleV1.ListUserExampleReply, error) {
|
||||
err := req.Validate()
|
||||
if err != nil {
|
||||
|
@ -186,7 +186,7 @@ func (s *userExample) List(ctx context.Context, req *serverNameExampleV1.ListUse
|
|||
}, nil
|
||||
}
|
||||
|
||||
// DeleteByIDs delete records by batch id
|
||||
// DeleteByIDs delete userExample by batch id
|
||||
func (s *userExample) DeleteByIDs(ctx context.Context, req *serverNameExampleV1.DeleteUserExampleByIDsRequest) (*serverNameExampleV1.DeleteUserExampleByIDsReply, error) {
|
||||
err := req.Validate()
|
||||
if err != nil {
|
||||
|
@ -204,7 +204,7 @@ func (s *userExample) DeleteByIDs(ctx context.Context, req *serverNameExampleV1.
|
|||
return &serverNameExampleV1.DeleteUserExampleByIDsReply{}, nil
|
||||
}
|
||||
|
||||
// GetByCondition get a record by id
|
||||
// GetByCondition get userExample details by custom condition
|
||||
func (s *userExample) GetByCondition(ctx context.Context, req *serverNameExampleV1.GetUserExampleByConditionRequest) (*serverNameExampleV1.GetUserExampleByConditionReply, error) {
|
||||
err := req.Validate()
|
||||
if err != nil {
|
||||
|
@ -246,7 +246,7 @@ func (s *userExample) GetByCondition(ctx context.Context, req *serverNameExample
|
|||
}, nil
|
||||
}
|
||||
|
||||
// ListByIDs list of records by batch id
|
||||
// ListByIDs get a list of userExample by batch id
|
||||
func (s *userExample) ListByIDs(ctx context.Context, req *serverNameExampleV1.ListUserExampleByIDsRequest) (*serverNameExampleV1.ListUserExampleByIDsReply, error) {
|
||||
err := req.Validate()
|
||||
if err != nil {
|
||||
|
@ -276,7 +276,7 @@ func (s *userExample) ListByIDs(ctx context.Context, req *serverNameExampleV1.Li
|
|||
return &serverNameExampleV1.ListUserExampleByIDsReply{UserExamples: userExamples}, nil
|
||||
}
|
||||
|
||||
// ListByLastID list userExample by last id
|
||||
// ListByLastID get a list of userExample by last id
|
||||
func (s *userExample) ListByLastID(ctx context.Context, req *serverNameExampleV1.ListUserExampleByLastIDRequest) (*serverNameExampleV1.ListUserExampleByLastIDReply, error) {
|
||||
err := req.Validate()
|
||||
if err != nil {
|
||||
|
|
|
@ -47,7 +47,7 @@ func New{{.TableNameCamel}}Server() serverNameExampleV1.{{.TableNameCamel}}Serve
|
|||
}
|
||||
}
|
||||
|
||||
// Create a record
|
||||
// Create a new {{.TableNameCamelFCL}}
|
||||
func (s *{{.TableNameCamelFCL}}) Create(ctx context.Context, req *serverNameExampleV1.Create{{.TableNameCamel}}Request) (*serverNameExampleV1.Create{{.TableNameCamel}}Reply, error) {
|
||||
err := req.Validate()
|
||||
if err != nil {
|
||||
|
@ -72,7 +72,7 @@ func (s *{{.TableNameCamelFCL}}) Create(ctx context.Context, req *serverNameExam
|
|||
return &serverNameExampleV1.Create{{.TableNameCamel}}Reply{ {{if .IsStandardPrimaryKey}}Id{{else}}{{.ColumnNameCamel}}{{end}}: record.{{.ColumnNameCamel}} }, nil
|
||||
}
|
||||
|
||||
// DeleteBy{{.ColumnNameCamel}} delete a record by {{.ColumnNameCamelFCL}}
|
||||
// DeleteBy{{.ColumnNameCamel}} delete a {{.TableNameCamelFCL}} by {{.ColumnNameCamelFCL}}
|
||||
func (s *{{.TableNameCamelFCL}}) DeleteBy{{.ColumnNameCamel}}(ctx context.Context, req *serverNameExampleV1.Delete{{.TableNameCamel}}By{{.ColumnNameCamel}}Request) (*serverNameExampleV1.Delete{{.TableNameCamel}}By{{.ColumnNameCamel}}Reply, error) {
|
||||
err := req.Validate()
|
||||
if err != nil {
|
||||
|
@ -90,7 +90,7 @@ func (s *{{.TableNameCamelFCL}}) DeleteBy{{.ColumnNameCamel}}(ctx context.Contex
|
|||
return &serverNameExampleV1.Delete{{.TableNameCamel}}By{{.ColumnNameCamel}}Reply{}, nil
|
||||
}
|
||||
|
||||
// UpdateBy{{.ColumnNameCamel}} update a record by {{.ColumnNameCamelFCL}}
|
||||
// UpdateBy{{.ColumnNameCamel}} update a {{.TableNameCamelFCL}} by {{.ColumnNameCamelFCL}}
|
||||
func (s *{{.TableNameCamelFCL}}) UpdateBy{{.ColumnNameCamel}}(ctx context.Context, req *serverNameExampleV1.Update{{.TableNameCamel}}By{{.ColumnNameCamel}}Request) (*serverNameExampleV1.Update{{.TableNameCamel}}By{{.ColumnNameCamel}}Reply, error) {
|
||||
err := req.Validate()
|
||||
if err != nil {
|
||||
|
@ -116,7 +116,7 @@ func (s *{{.TableNameCamelFCL}}) UpdateBy{{.ColumnNameCamel}}(ctx context.Contex
|
|||
return &serverNameExampleV1.Update{{.TableNameCamel}}By{{.ColumnNameCamel}}Reply{}, nil
|
||||
}
|
||||
|
||||
// GetBy{{.ColumnNameCamel}} get a record by {{.ColumnNameCamelFCL}}
|
||||
// GetBy{{.ColumnNameCamel}} get {{.TableNameCamelFCL}} details by {{.ColumnNameCamelFCL}}
|
||||
func (s *{{.TableNameCamelFCL}}) GetBy{{.ColumnNameCamel}}(ctx context.Context, req *serverNameExampleV1.Get{{.TableNameCamel}}By{{.ColumnNameCamel}}Request) (*serverNameExampleV1.Get{{.TableNameCamel}}By{{.ColumnNameCamel}}Reply, error) {
|
||||
err := req.Validate()
|
||||
if err != nil {
|
||||
|
@ -144,7 +144,7 @@ func (s *{{.TableNameCamelFCL}}) GetBy{{.ColumnNameCamel}}(ctx context.Context,
|
|||
return &serverNameExampleV1.Get{{.TableNameCamel}}By{{.ColumnNameCamel}}Reply{ {{.TableNameCamel}}: data}, nil
|
||||
}
|
||||
|
||||
// List of records by query parameters
|
||||
// List get a list of {{.TableNameCamelFCL}} by custom conditions
|
||||
func (s *{{.TableNameCamelFCL}}) List(ctx context.Context, req *serverNameExampleV1.List{{.TableNameCamel}}Request) (*serverNameExampleV1.List{{.TableNameCamel}}Reply, error) {
|
||||
err := req.Validate()
|
||||
if err != nil {
|
||||
|
@ -186,7 +186,7 @@ func (s *{{.TableNameCamelFCL}}) List(ctx context.Context, req *serverNameExampl
|
|||
}, nil
|
||||
}
|
||||
|
||||
// DeleteBy{{.ColumnNamePluralCamel}} delete records by batch {{.ColumnNameCamelFCL}}
|
||||
// DeleteBy{{.ColumnNamePluralCamel}} delete {{.TableNameCamelFCL}} by batch {{.ColumnNameCamelFCL}}
|
||||
func (s *{{.TableNameCamelFCL}}) DeleteBy{{.ColumnNamePluralCamel}}(ctx context.Context, req *serverNameExampleV1.Delete{{.TableNameCamel}}By{{.ColumnNamePluralCamel}}Request) (*serverNameExampleV1.Delete{{.TableNameCamel}}By{{.ColumnNamePluralCamel}}Reply, error) {
|
||||
err := req.Validate()
|
||||
if err != nil {
|
||||
|
@ -204,7 +204,7 @@ func (s *{{.TableNameCamelFCL}}) DeleteBy{{.ColumnNamePluralCamel}}(ctx context.
|
|||
return &serverNameExampleV1.Delete{{.TableNameCamel}}By{{.ColumnNamePluralCamel}}Reply{}, nil
|
||||
}
|
||||
|
||||
// GetByCondition get a record by {{.ColumnNameCamelFCL}}
|
||||
// GetByCondition get {{.TableNameCamelFCL}} details by custom condition
|
||||
func (s *{{.TableNameCamelFCL}}) GetByCondition(ctx context.Context, req *serverNameExampleV1.Get{{.TableNameCamel}}ByConditionRequest) (*serverNameExampleV1.Get{{.TableNameCamel}}ByConditionReply, error) {
|
||||
err := req.Validate()
|
||||
if err != nil {
|
||||
|
@ -246,7 +246,7 @@ func (s *{{.TableNameCamelFCL}}) GetByCondition(ctx context.Context, req *server
|
|||
}, nil
|
||||
}
|
||||
|
||||
// ListBy{{.ColumnNamePluralCamel}} list of records by batch {{.ColumnNameCamelFCL}}
|
||||
// ListBy{{.ColumnNamePluralCamel}} get a list of {{.TableNameCamelFCL}} by batch {{.ColumnNameCamelFCL}}
|
||||
func (s *{{.TableNameCamelFCL}}) ListBy{{.ColumnNamePluralCamel}}(ctx context.Context, req *serverNameExampleV1.List{{.TableNameCamel}}By{{.ColumnNamePluralCamel}}Request) (*serverNameExampleV1.List{{.TableNameCamel}}By{{.ColumnNamePluralCamel}}Reply, error) {
|
||||
err := req.Validate()
|
||||
if err != nil {
|
||||
|
@ -276,7 +276,7 @@ func (s *{{.TableNameCamelFCL}}) ListBy{{.ColumnNamePluralCamel}}(ctx context.Co
|
|||
return &serverNameExampleV1.List{{.TableNameCamel}}By{{.ColumnNamePluralCamel}}Reply{ {{.TableNamePluralCamel}}: {{.TableNamePluralCamelFCL}} }, nil
|
||||
}
|
||||
|
||||
// ListByLast{{.ColumnNameCamel}} list {{.TableNameCamelFCL}} by last {{.ColumnNameCamelFCL}}
|
||||
// ListByLast{{.ColumnNameCamel}} get a list of {{.TableNameCamelFCL}} by last {{.ColumnNameCamelFCL}}
|
||||
func (s *{{.TableNameCamelFCL}}) ListByLast{{.ColumnNameCamel}}(ctx context.Context, req *serverNameExampleV1.List{{.TableNameCamel}}ByLast{{.ColumnNameCamel}}Request) (*serverNameExampleV1.List{{.TableNameCamel}}ByLast{{.ColumnNameCamel}}Reply, error) {
|
||||
err := req.Validate()
|
||||
if err != nil {
|
||||
|
|
|
@ -47,7 +47,7 @@ func NewUserExampleServer() serverNameExampleV1.UserExampleServer {
|
|||
}
|
||||
}
|
||||
|
||||
// Create a record
|
||||
// Create a new userExample
|
||||
func (s *userExample) Create(ctx context.Context, req *serverNameExampleV1.CreateUserExampleRequest) (*serverNameExampleV1.CreateUserExampleReply, error) {
|
||||
err := req.Validate()
|
||||
if err != nil {
|
||||
|
@ -72,7 +72,7 @@ func (s *userExample) Create(ctx context.Context, req *serverNameExampleV1.Creat
|
|||
return &serverNameExampleV1.CreateUserExampleReply{Id: record.ID.Hex()}, nil
|
||||
}
|
||||
|
||||
// DeleteByID delete a record by id
|
||||
// DeleteByID delete a userExample by id
|
||||
func (s *userExample) DeleteByID(ctx context.Context, req *serverNameExampleV1.DeleteUserExampleByIDRequest) (*serverNameExampleV1.DeleteUserExampleByIDReply, error) {
|
||||
err := req.Validate()
|
||||
if err != nil {
|
||||
|
@ -90,7 +90,7 @@ func (s *userExample) DeleteByID(ctx context.Context, req *serverNameExampleV1.D
|
|||
return &serverNameExampleV1.DeleteUserExampleByIDReply{}, nil
|
||||
}
|
||||
|
||||
// UpdateByID update a record by id
|
||||
// UpdateByID update a userExample by id
|
||||
func (s *userExample) UpdateByID(ctx context.Context, req *serverNameExampleV1.UpdateUserExampleByIDRequest) (*serverNameExampleV1.UpdateUserExampleByIDReply, error) {
|
||||
err := req.Validate()
|
||||
if err != nil {
|
||||
|
@ -116,7 +116,7 @@ func (s *userExample) UpdateByID(ctx context.Context, req *serverNameExampleV1.U
|
|||
return &serverNameExampleV1.UpdateUserExampleByIDReply{}, nil
|
||||
}
|
||||
|
||||
// GetByID get a record by id
|
||||
// GetByID get userExample details by id
|
||||
func (s *userExample) GetByID(ctx context.Context, req *serverNameExampleV1.GetUserExampleByIDRequest) (*serverNameExampleV1.GetUserExampleByIDReply, error) {
|
||||
err := req.Validate()
|
||||
if err != nil {
|
||||
|
@ -144,7 +144,7 @@ func (s *userExample) GetByID(ctx context.Context, req *serverNameExampleV1.GetU
|
|||
return &serverNameExampleV1.GetUserExampleByIDReply{UserExample: data}, nil
|
||||
}
|
||||
|
||||
// List of records by query parameters
|
||||
// List get a list of userExample by custom conditions
|
||||
func (s *userExample) List(ctx context.Context, req *serverNameExampleV1.ListUserExampleRequest) (*serverNameExampleV1.ListUserExampleReply, error) {
|
||||
err := req.Validate()
|
||||
if err != nil {
|
||||
|
|
|
@ -47,7 +47,7 @@ func NewUserExampleServer() serverNameExampleV1.UserExampleServer {
|
|||
}
|
||||
}
|
||||
|
||||
// Create a record
|
||||
// Create a new userExample
|
||||
func (s *userExample) Create(ctx context.Context, req *serverNameExampleV1.CreateUserExampleRequest) (*serverNameExampleV1.CreateUserExampleReply, error) {
|
||||
err := req.Validate()
|
||||
if err != nil {
|
||||
|
@ -72,7 +72,7 @@ func (s *userExample) Create(ctx context.Context, req *serverNameExampleV1.Creat
|
|||
return &serverNameExampleV1.CreateUserExampleReply{Id: record.ID.Hex()}, nil
|
||||
}
|
||||
|
||||
// DeleteByID delete a record by id
|
||||
// DeleteByID delete a userExample by id
|
||||
func (s *userExample) DeleteByID(ctx context.Context, req *serverNameExampleV1.DeleteUserExampleByIDRequest) (*serverNameExampleV1.DeleteUserExampleByIDReply, error) {
|
||||
err := req.Validate()
|
||||
if err != nil {
|
||||
|
@ -90,7 +90,7 @@ func (s *userExample) DeleteByID(ctx context.Context, req *serverNameExampleV1.D
|
|||
return &serverNameExampleV1.DeleteUserExampleByIDReply{}, nil
|
||||
}
|
||||
|
||||
// UpdateByID update a record by id
|
||||
// UpdateByID update a userExample by id
|
||||
func (s *userExample) UpdateByID(ctx context.Context, req *serverNameExampleV1.UpdateUserExampleByIDRequest) (*serverNameExampleV1.UpdateUserExampleByIDReply, error) {
|
||||
err := req.Validate()
|
||||
if err != nil {
|
||||
|
@ -116,7 +116,7 @@ func (s *userExample) UpdateByID(ctx context.Context, req *serverNameExampleV1.U
|
|||
return &serverNameExampleV1.UpdateUserExampleByIDReply{}, nil
|
||||
}
|
||||
|
||||
// GetByID get a record by id
|
||||
// GetByID get userExample details by id
|
||||
func (s *userExample) GetByID(ctx context.Context, req *serverNameExampleV1.GetUserExampleByIDRequest) (*serverNameExampleV1.GetUserExampleByIDReply, error) {
|
||||
err := req.Validate()
|
||||
if err != nil {
|
||||
|
@ -144,7 +144,7 @@ func (s *userExample) GetByID(ctx context.Context, req *serverNameExampleV1.GetU
|
|||
return &serverNameExampleV1.GetUserExampleByIDReply{UserExample: data}, nil
|
||||
}
|
||||
|
||||
// List of records by query parameters
|
||||
// List get a list of userExample by custom conditions
|
||||
func (s *userExample) List(ctx context.Context, req *serverNameExampleV1.ListUserExampleRequest) (*serverNameExampleV1.ListUserExampleReply, error) {
|
||||
err := req.Validate()
|
||||
if err != nil {
|
||||
|
@ -186,7 +186,7 @@ func (s *userExample) List(ctx context.Context, req *serverNameExampleV1.ListUse
|
|||
}, nil
|
||||
}
|
||||
|
||||
// DeleteByIDs delete records by batch id
|
||||
// DeleteByIDs delete userExample by batch id
|
||||
func (s *userExample) DeleteByIDs(ctx context.Context, req *serverNameExampleV1.DeleteUserExampleByIDsRequest) (*serverNameExampleV1.DeleteUserExampleByIDsReply, error) {
|
||||
err := req.Validate()
|
||||
if err != nil {
|
||||
|
@ -204,7 +204,7 @@ func (s *userExample) DeleteByIDs(ctx context.Context, req *serverNameExampleV1.
|
|||
return &serverNameExampleV1.DeleteUserExampleByIDsReply{}, nil
|
||||
}
|
||||
|
||||
// GetByCondition get a record by id
|
||||
// GetByCondition get userExample details by custom condition
|
||||
func (s *userExample) GetByCondition(ctx context.Context, req *serverNameExampleV1.GetUserExampleByConditionRequest) (*serverNameExampleV1.GetUserExampleByConditionReply, error) {
|
||||
err := req.Validate()
|
||||
if err != nil {
|
||||
|
@ -246,7 +246,7 @@ func (s *userExample) GetByCondition(ctx context.Context, req *serverNameExample
|
|||
}, nil
|
||||
}
|
||||
|
||||
// ListByIDs list of records by batch id
|
||||
// ListByIDs get a list of userExample by batch id
|
||||
func (s *userExample) ListByIDs(ctx context.Context, req *serverNameExampleV1.ListUserExampleByIDsRequest) (*serverNameExampleV1.ListUserExampleByIDsReply, error) {
|
||||
err := req.Validate()
|
||||
if err != nil {
|
||||
|
@ -276,7 +276,7 @@ func (s *userExample) ListByIDs(ctx context.Context, req *serverNameExampleV1.Li
|
|||
return &serverNameExampleV1.ListUserExampleByIDsReply{UserExamples: userExamples}, nil
|
||||
}
|
||||
|
||||
// ListByLastID list userExample by last id
|
||||
// ListByLastID get a list of userExample by last id
|
||||
func (s *userExample) ListByLastID(ctx context.Context, req *serverNameExampleV1.ListUserExampleByLastIDRequest) (*serverNameExampleV1.ListUserExampleByLastIDReply, error) {
|
||||
err := req.Validate()
|
||||
if err != nil {
|
||||
|
|
|
@ -46,7 +46,7 @@ func New{{.TableNameCamel}}Server() serverNameExampleV1.{{.TableNameCamel}}Serve
|
|||
}
|
||||
}
|
||||
|
||||
// Create a record
|
||||
// Create a new {{.TableNameCamelFCL}}
|
||||
func (s *{{.TableNameCamelFCL}}) Create(ctx context.Context, req *serverNameExampleV1.Create{{.TableNameCamel}}Request) (*serverNameExampleV1.Create{{.TableNameCamel}}Reply, error) {
|
||||
err := req.Validate()
|
||||
if err != nil {
|
||||
|
@ -71,7 +71,7 @@ func (s *{{.TableNameCamelFCL}}) Create(ctx context.Context, req *serverNameExam
|
|||
return &serverNameExampleV1.Create{{.TableNameCamel}}Reply{ {{if .IsStandardPrimaryKey}}Id{{else}}{{.ColumnNameCamel}}{{end}}: record.{{.ColumnNameCamel}} }, nil
|
||||
}
|
||||
|
||||
// DeleteBy{{.ColumnNameCamel}} delete a record by {{.ColumnNameCamelFCL}}
|
||||
// DeleteBy{{.ColumnNameCamel}} delete a {{.TableNameCamelFCL}} by {{.ColumnNameCamelFCL}}
|
||||
func (s *{{.TableNameCamelFCL}}) DeleteBy{{.ColumnNameCamel}}(ctx context.Context, req *serverNameExampleV1.Delete{{.TableNameCamel}}By{{.ColumnNameCamel}}Request) (*serverNameExampleV1.Delete{{.TableNameCamel}}By{{.ColumnNameCamel}}Reply, error) {
|
||||
err := req.Validate()
|
||||
if err != nil {
|
||||
|
@ -89,7 +89,7 @@ func (s *{{.TableNameCamelFCL}}) DeleteBy{{.ColumnNameCamel}}(ctx context.Contex
|
|||
return &serverNameExampleV1.Delete{{.TableNameCamel}}By{{.ColumnNameCamel}}Reply{}, nil
|
||||
}
|
||||
|
||||
// UpdateBy{{.ColumnNameCamel}} update a record by {{.ColumnNameCamelFCL}}
|
||||
// UpdateBy{{.ColumnNameCamel}} update a {{.TableNameCamelFCL}} by {{.ColumnNameCamelFCL}}
|
||||
func (s *{{.TableNameCamelFCL}}) UpdateBy{{.ColumnNameCamel}}(ctx context.Context, req *serverNameExampleV1.Update{{.TableNameCamel}}By{{.ColumnNameCamel}}Request) (*serverNameExampleV1.Update{{.TableNameCamel}}By{{.ColumnNameCamel}}Reply, error) {
|
||||
err := req.Validate()
|
||||
if err != nil {
|
||||
|
@ -115,7 +115,7 @@ func (s *{{.TableNameCamelFCL}}) UpdateBy{{.ColumnNameCamel}}(ctx context.Contex
|
|||
return &serverNameExampleV1.Update{{.TableNameCamel}}By{{.ColumnNameCamel}}Reply{}, nil
|
||||
}
|
||||
|
||||
// GetBy{{.ColumnNameCamel}} get a record by {{.ColumnNameCamelFCL}}
|
||||
// GetBy{{.ColumnNameCamel}} get {{.TableNameCamelFCL}} details by {{.ColumnNameCamelFCL}}
|
||||
func (s *{{.TableNameCamelFCL}}) GetBy{{.ColumnNameCamel}}(ctx context.Context, req *serverNameExampleV1.Get{{.TableNameCamel}}By{{.ColumnNameCamel}}Request) (*serverNameExampleV1.Get{{.TableNameCamel}}By{{.ColumnNameCamel}}Reply, error) {
|
||||
err := req.Validate()
|
||||
if err != nil {
|
||||
|
@ -143,7 +143,7 @@ func (s *{{.TableNameCamelFCL}}) GetBy{{.ColumnNameCamel}}(ctx context.Context,
|
|||
return &serverNameExampleV1.Get{{.TableNameCamel}}By{{.ColumnNameCamel}}Reply{ {{.TableNameCamel}}: data}, nil
|
||||
}
|
||||
|
||||
// List of records by query parameters
|
||||
// List get a list of {{.TableNameCamelFCL}} by custom conditions
|
||||
func (s *{{.TableNameCamelFCL}}) List(ctx context.Context, req *serverNameExampleV1.List{{.TableNameCamel}}Request) (*serverNameExampleV1.List{{.TableNameCamel}}Reply, error) {
|
||||
err := req.Validate()
|
||||
if err != nil {
|
||||
|
|
|
@ -286,11 +286,12 @@ func ListGRPCErrCodes(w http.ResponseWriter, _ *http.Request) {
|
|||
}
|
||||
|
||||
// ShowConfig show config info
|
||||
// @Summary show config info
|
||||
// @Description show config info
|
||||
// @Summary get system configuration
|
||||
// @Description Returns the current system configuration in JSON format. This includes all runtime configuration parameters.
|
||||
// @Tags system
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Success 200 {object} map[string]interface{} "Returns the complete system configuration"
|
||||
// @Router /config [get]
|
||||
func ShowConfig(jsonData []byte) func(w http.ResponseWriter, r *http.Request) {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
|
|
|
@ -20,34 +20,38 @@ type CheckHealthReply struct {
|
|||
}
|
||||
|
||||
// CheckHealth check healthy.
|
||||
// @Summary check health
|
||||
// @Description check health
|
||||
// @Summary check system health status
|
||||
// @Description Returns system health information including status and hostname
|
||||
// @Tags system
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Success 200 {object} CheckHealthReply{}
|
||||
// @Success 200 {object} CheckHealthReply "Returns health status information"
|
||||
// @Router /health [get]
|
||||
func CheckHealth(c *gin.Context) {
|
||||
c.JSON(http.StatusOK, CheckHealthReply{Status: "UP", Hostname: utils.GetHostname()})
|
||||
}
|
||||
|
||||
// Ping ping
|
||||
// @Summary ping
|
||||
// @Description ping
|
||||
type PingReply struct{}
|
||||
|
||||
// Ping the server
|
||||
// @Summary ping the server
|
||||
// @Description Simple ping endpoint to check if server is responsive
|
||||
// @Tags system
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Success 200 {object} PingReply "Returns empty JSON object"
|
||||
// @Router /ping [get]
|
||||
func Ping(c *gin.Context) {
|
||||
c.JSON(http.StatusOK, gin.H{})
|
||||
}
|
||||
|
||||
// ListCodes list error codes info
|
||||
// @Summary list error codes info
|
||||
// @Description list error codes info
|
||||
// @Summary list all error codes
|
||||
// @Description Returns a list of all defined HTTP error codes and their descriptions
|
||||
// @Tags system
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Success 200 {array} errcode.ErrInfo "List of error codes"
|
||||
// @Router /codes [get]
|
||||
func ListCodes(c *gin.Context) {
|
||||
c.JSON(http.StatusOK, errcode.ListHTTPErrCodes())
|
||||
|
|
|
@ -22,7 +22,7 @@ import (
|
|||
// @title serverNameExample api docs
|
||||
// @description http server api docs
|
||||
// @schemes http https
|
||||
// @version 2.0
|
||||
// @version v1.0.0
|
||||
// @host localhost:8080
|
||||
// @securityDefinitions.apikey BearerAuth
|
||||
// @in header
|
||||
|
@ -43,7 +43,7 @@ func main() {
|
|||
// @Summary create user
|
||||
// @Description submit information to create user
|
||||
// @Tags user
|
||||
// @accept json
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param data body types.CreateUserRequest true "user information"
|
||||
// @Success 200 {object} types.CreateUserReply{}
|
||||
|
|
|
@ -49,31 +49,31 @@ import "validate/validate.proto";
|
|||
option go_package = "github.com/go-dev-frame/sponge/api/serverNameExample/v1;v1";
|
||||
|
||||
service {{.TName}} {
|
||||
// create {{.TName}}
|
||||
// create a new {{.TName}}
|
||||
rpc Create(Create{{.TableName}}Request) returns (Create{{.TableName}}Reply) {}
|
||||
|
||||
// delete {{.TName}} by {{.CrudInfo.ColumnNameCamelFCL}}
|
||||
// delete a {{.TName}} by {{.CrudInfo.ColumnNameCamelFCL}}
|
||||
rpc DeleteBy{{.CrudInfo.ColumnNameCamel}}(Delete{{.TableName}}By{{.CrudInfo.ColumnNameCamel}}Request) returns (Delete{{.TableName}}By{{.CrudInfo.ColumnNameCamel}}Reply) {}
|
||||
|
||||
// update {{.TName}} by {{.CrudInfo.ColumnNameCamelFCL}}
|
||||
// update a {{.TName}} by {{.CrudInfo.ColumnNameCamelFCL}}
|
||||
rpc UpdateBy{{.CrudInfo.ColumnNameCamel}}(Update{{.TableName}}By{{.CrudInfo.ColumnNameCamel}}Request) returns (Update{{.TableName}}By{{.CrudInfo.ColumnNameCamel}}Reply) {}
|
||||
|
||||
// get {{.TName}} by {{.CrudInfo.ColumnNameCamelFCL}}
|
||||
// get {{.TName}} details by {{.CrudInfo.ColumnNameCamelFCL}}
|
||||
rpc GetBy{{.CrudInfo.ColumnNameCamel}}(Get{{.TableName}}By{{.CrudInfo.ColumnNameCamel}}Request) returns (Get{{.TableName}}By{{.CrudInfo.ColumnNameCamel}}Reply) {}
|
||||
|
||||
// list of {{.TName}} by query parameters
|
||||
// get a list of {{.TName}} by custom conditions
|
||||
rpc List(List{{.TableName}}Request) returns (List{{.TableName}}Reply) {}
|
||||
|
||||
// delete {{.TName}} by batch {{.CrudInfo.ColumnNameCamelFCL}}
|
||||
rpc DeleteBy{{.CrudInfo.ColumnNamePluralCamel}}(Delete{{.TableName}}By{{.CrudInfo.ColumnNamePluralCamel}}Request) returns (Delete{{.TableName}}By{{.CrudInfo.ColumnNamePluralCamel}}Reply) {}
|
||||
|
||||
// get {{.TName}} by condition
|
||||
// get {{.TName}} details by custom condition
|
||||
rpc GetByCondition(Get{{.TableName}}ByConditionRequest) returns (Get{{.TableName}}ByConditionReply) {}
|
||||
|
||||
// list of {{.TName}} by batch {{.CrudInfo.ColumnNameCamelFCL}}
|
||||
// get a list of {{.TName}} by batch {{.CrudInfo.ColumnNameCamelFCL}}
|
||||
rpc ListBy{{.CrudInfo.ColumnNamePluralCamel}}(List{{.TableName}}By{{.CrudInfo.ColumnNamePluralCamel}}Request) returns (List{{.TableName}}By{{.CrudInfo.ColumnNamePluralCamel}}Reply) {}
|
||||
|
||||
// list {{.TName}} by last {{.CrudInfo.ColumnNameCamelFCL}}
|
||||
// get a list of {{.TName}} by last {{.CrudInfo.ColumnNameCamelFCL}}
|
||||
rpc ListByLast{{.CrudInfo.ColumnNameCamel}}(List{{.TableName}}ByLast{{.CrudInfo.ColumnNameCamel}}Request) returns (List{{.TableName}}ByLast{{.CrudInfo.ColumnNameCamel}}Reply) {}
|
||||
}
|
||||
|
||||
|
@ -172,19 +172,19 @@ import "validate/validate.proto";
|
|||
option go_package = "github.com/go-dev-frame/sponge/api/serverNameExample/v1;v1";
|
||||
|
||||
service {{.TName}} {
|
||||
// create {{.TName}}
|
||||
// create a new {{.TName}}
|
||||
rpc Create(Create{{.TableName}}Request) returns (Create{{.TableName}}Reply) {}
|
||||
|
||||
// delete {{.TName}} by {{.CrudInfo.ColumnNameCamelFCL}}
|
||||
// delete a {{.TName}} by {{.CrudInfo.ColumnNameCamelFCL}}
|
||||
rpc DeleteBy{{.CrudInfo.ColumnNameCamel}}(Delete{{.TableName}}By{{.CrudInfo.ColumnNameCamel}}Request) returns (Delete{{.TableName}}By{{.CrudInfo.ColumnNameCamel}}Reply) {}
|
||||
|
||||
// update {{.TName}} by {{.CrudInfo.ColumnNameCamelFCL}}
|
||||
// update a {{.TName}} by {{.CrudInfo.ColumnNameCamelFCL}}
|
||||
rpc UpdateBy{{.CrudInfo.ColumnNameCamel}}(Update{{.TableName}}By{{.CrudInfo.ColumnNameCamel}}Request) returns (Update{{.TableName}}By{{.CrudInfo.ColumnNameCamel}}Reply) {}
|
||||
|
||||
// get {{.TName}} by {{.CrudInfo.ColumnNameCamelFCL}}
|
||||
// get {{.TName}} details by {{.CrudInfo.ColumnNameCamelFCL}}
|
||||
rpc GetBy{{.CrudInfo.ColumnNameCamel}}(Get{{.TableName}}By{{.CrudInfo.ColumnNameCamel}}Request) returns (Get{{.TableName}}By{{.CrudInfo.ColumnNameCamel}}Reply) {}
|
||||
|
||||
// list of {{.TName}} by query parameters
|
||||
// get a list of {{.TName}} by custom conditions
|
||||
rpc List(List{{.TableName}}Request) returns (List{{.TableName}}Reply) {}
|
||||
}
|
||||
|
||||
|
@ -252,13 +252,11 @@ import "validate/validate.proto";
|
|||
option go_package = "github.com/go-dev-frame/sponge/api/serverNameExample/v1;v1";
|
||||
|
||||
/*
|
||||
Reference https://github.com/grpc-ecosystem/grpc-gateway/blob/db7fbefff7c04877cdb32e16d4a248a024428207/examples/internal/proto/examplepb/a_bit_of_everything.proto
|
||||
Default settings for generating swagger documents
|
||||
NOTE: because json does not support 64 bits, the int64 and uint64 types under *.swagger.json are automatically converted to string types
|
||||
Tips: add swagger option to rpc method, example:
|
||||
Default settings for generating *.swagger.json documents. For reference, see: https://bit.ly/4dE5jj7
|
||||
Tip: To enhance the generated Swagger documentation, you can add the openapiv2_operation option to your RPC method. For example:
|
||||
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
|
||||
summary: "get user by id",
|
||||
description: "get user by id",
|
||||
summary: "get user details by id",
|
||||
description: "Gets detailed information of a userExample specified by the given id in the path.",
|
||||
security: {
|
||||
security_requirement: {
|
||||
key: "BearerAuth";
|
||||
|
@ -272,7 +270,7 @@ option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_swagger) = {
|
|||
base_path: ""
|
||||
info: {
|
||||
title: "serverNameExample api docs";
|
||||
version: "2.0";
|
||||
version: "v1.0.0";
|
||||
}
|
||||
schemes: HTTP;
|
||||
schemes: HTTPS;
|
||||
|
@ -292,7 +290,7 @@ option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_swagger) = {
|
|||
};
|
||||
|
||||
service {{.TName}} {
|
||||
// create {{.TName}}
|
||||
// create a new {{.TName}}
|
||||
rpc Create(Create{{.TableName}}Request) returns (Create{{.TableName}}Reply) {
|
||||
option (google.api.http) = {
|
||||
post: "/api/v1/{{.TName}}"
|
||||
|
@ -300,14 +298,14 @@ service {{.TName}} {
|
|||
};
|
||||
}
|
||||
|
||||
// delete {{.TName}} by {{.CrudInfo.ColumnNameCamelFCL}}
|
||||
// delete a {{.TName}} by {{.CrudInfo.ColumnNameCamelFCL}}
|
||||
rpc DeleteBy{{.CrudInfo.ColumnNameCamel}}(Delete{{.TableName}}By{{.CrudInfo.ColumnNameCamel}}Request) returns (Delete{{.TableName}}By{{.CrudInfo.ColumnNameCamel}}Reply) {
|
||||
option (google.api.http) = {
|
||||
delete: "/api/v1/{{.TName}}/left_curly_bracket{{.CrudInfo.ColumnNameCamelFCL}}right_curly_bracket"
|
||||
};
|
||||
}
|
||||
|
||||
// update {{.TName}} by {{.CrudInfo.ColumnNameCamelFCL}}
|
||||
// update a {{.TName}} by {{.CrudInfo.ColumnNameCamelFCL}}
|
||||
rpc UpdateBy{{.CrudInfo.ColumnNameCamel}}(Update{{.TableName}}By{{.CrudInfo.ColumnNameCamel}}Request) returns (Update{{.TableName}}By{{.CrudInfo.ColumnNameCamel}}Reply) {
|
||||
option (google.api.http) = {
|
||||
put: "/api/v1/{{.TName}}/left_curly_bracket{{.CrudInfo.ColumnNameCamelFCL}}right_curly_bracket"
|
||||
|
@ -315,14 +313,14 @@ service {{.TName}} {
|
|||
};
|
||||
}
|
||||
|
||||
// get {{.TName}} by {{.CrudInfo.ColumnNameCamelFCL}}
|
||||
// get {{.TName}} details by {{.CrudInfo.ColumnNameCamelFCL}}
|
||||
rpc GetBy{{.CrudInfo.ColumnNameCamel}}(Get{{.TableName}}By{{.CrudInfo.ColumnNameCamel}}Request) returns (Get{{.TableName}}By{{.CrudInfo.ColumnNameCamel}}Reply) {
|
||||
option (google.api.http) = {
|
||||
get: "/api/v1/{{.TName}}/left_curly_bracket{{.CrudInfo.ColumnNameCamelFCL}}right_curly_bracket"
|
||||
};
|
||||
}
|
||||
|
||||
// list of {{.TName}} by query parameters
|
||||
// get a list of {{.TName}} by custom conditions
|
||||
rpc List(List{{.TableName}}Request) returns (List{{.TableName}}Reply) {
|
||||
option (google.api.http) = {
|
||||
post: "/api/v1/{{.TName}}/list"
|
||||
|
@ -338,7 +336,7 @@ service {{.TName}} {
|
|||
};
|
||||
}
|
||||
|
||||
// get {{.TName}} by condition
|
||||
// get a {{.TName}} by custom conditions
|
||||
rpc GetByCondition(Get{{.TableName}}ByConditionRequest) returns (Get{{.TableName}}ByConditionReply) {
|
||||
option (google.api.http) = {
|
||||
post: "/api/v1/{{.TName}}/condition"
|
||||
|
@ -346,7 +344,7 @@ service {{.TName}} {
|
|||
};
|
||||
}
|
||||
|
||||
// list of {{.TName}} by batch {{.CrudInfo.ColumnNameCamelFCL}}
|
||||
// get a list of {{.TName}} by batch {{.CrudInfo.ColumnNameCamelFCL}}
|
||||
rpc ListBy{{.CrudInfo.ColumnNamePluralCamel}}(List{{.TableName}}By{{.CrudInfo.ColumnNamePluralCamel}}Request) returns (List{{.TableName}}By{{.CrudInfo.ColumnNamePluralCamel}}Reply) {
|
||||
option (google.api.http) = {
|
||||
post: "/api/v1/{{.TName}}/list/ids"
|
||||
|
@ -354,7 +352,7 @@ service {{.TName}} {
|
|||
};
|
||||
}
|
||||
|
||||
// list {{.TName}} by last {{.CrudInfo.ColumnNameCamelFCL}}
|
||||
// get a list of {{.TName}} by last {{.CrudInfo.ColumnNameCamelFCL}}
|
||||
rpc ListByLast{{.CrudInfo.ColumnNameCamel}}(List{{.TableName}}ByLast{{.CrudInfo.ColumnNameCamel}}Request) returns (List{{.TableName}}ByLast{{.CrudInfo.ColumnNameCamel}}Reply) {
|
||||
option (google.api.http) = {
|
||||
get: "/api/v1/{{.TName}}/list"
|
||||
|
@ -377,11 +375,14 @@ If used to generate code that supports the HTTP protocol, notes for defining mes
|
|||
2. If the request url is followed by a query parameter, such as /api/v1/getUserExample?name=Tom,
|
||||
a form tag must be added when defining the query parameter in the message, such as:
|
||||
string name = 1 [(tagger.tags) = "form:\"name\""].
|
||||
3. If the message field name contain underscores(such as 'field_name'), it will cause a problem
|
||||
where the JSON field names of the Swagger request parameters are different from those of the
|
||||
GRPC JSON tag names. There are two solutions: Solution 1, remove the underline from the
|
||||
message field name. Option 2, use the tool 'protoc-go-inject-tag' to modify the JSON tag name,
|
||||
such as: string first_name = 1 ; // @gotags: json:"firstName"
|
||||
3. When the message fields use snake_case naming (e.g., order_id), the generated swagger.json file
|
||||
will use camelCase (e.g., orderId) instead of the expected snake_case. This behavior aligns with
|
||||
the JSON tag names used by gRPC, but it can cause the Gin framework to fail to correctly bind and
|
||||
retrieve parameter values. There are two ways to resolve this issue:
|
||||
(1) Explicitly specify the JSON tag name using the json_name option, such as:
|
||||
string order_id = 1 [json_name = "order_id"];
|
||||
(2) If you want to switch to camelCase naming and update the JSON tag name accordingly, such as:
|
||||
string order_id = 1 [json_name = "orderID", (tagger.tags) = "json:\"orderID\""];
|
||||
*/
|
||||
|
||||
|
||||
|
@ -473,10 +474,8 @@ import "validate/validate.proto";
|
|||
option go_package = "github.com/go-dev-frame/sponge/api/serverNameExample/v1;v1";
|
||||
|
||||
/*
|
||||
Reference https://github.com/grpc-ecosystem/grpc-gateway/blob/db7fbefff7c04877cdb32e16d4a248a024428207/examples/internal/proto/examplepb/a_bit_of_everything.proto
|
||||
Default settings for generating swagger documents
|
||||
NOTE: because json does not support 64 bits, the int64 and uint64 types under *.swagger.json are automatically converted to string types
|
||||
Tips: add swagger option to rpc method, example:
|
||||
Default settings for generating *.swagger.json documents. For reference, see: https://bit.ly/4dE5jj7
|
||||
Tip: To enhance the generated Swagger documentation, you can add the openapiv2_operation option to your RPC method. For example:
|
||||
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
|
||||
summary: "get user by id",
|
||||
description: "get user by id",
|
||||
|
@ -493,7 +492,7 @@ option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_swagger) = {
|
|||
base_path: ""
|
||||
info: {
|
||||
title: "serverNameExample api docs";
|
||||
version: "2.0";
|
||||
version: "v1.0.0";
|
||||
}
|
||||
schemes: HTTP;
|
||||
schemes: HTTPS;
|
||||
|
@ -513,7 +512,7 @@ option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_swagger) = {
|
|||
};
|
||||
|
||||
service {{.TName}} {
|
||||
// create {{.TName}}
|
||||
// create a new {{.TName}}
|
||||
rpc Create(Create{{.TableName}}Request) returns (Create{{.TableName}}Reply) {
|
||||
option (google.api.http) = {
|
||||
post: "/api/v1/{{.TName}}"
|
||||
|
@ -521,14 +520,14 @@ service {{.TName}} {
|
|||
};
|
||||
}
|
||||
|
||||
// delete {{.TName}} by {{.CrudInfo.ColumnNameCamelFCL}}
|
||||
// delete a {{.TName}} by {{.CrudInfo.ColumnNameCamelFCL}}
|
||||
rpc DeleteBy{{.CrudInfo.ColumnNameCamel}}(Delete{{.TableName}}By{{.CrudInfo.ColumnNameCamel}}Request) returns (Delete{{.TableName}}By{{.CrudInfo.ColumnNameCamel}}Reply) {
|
||||
option (google.api.http) = {
|
||||
delete: "/api/v1/{{.TName}}/left_curly_bracket{{.CrudInfo.ColumnNameCamelFCL}}right_curly_bracket"
|
||||
};
|
||||
}
|
||||
|
||||
// update {{.TName}} by {{.CrudInfo.ColumnNameCamelFCL}}
|
||||
// update a {{.TName}} by {{.CrudInfo.ColumnNameCamelFCL}}
|
||||
rpc UpdateBy{{.CrudInfo.ColumnNameCamel}}(Update{{.TableName}}By{{.CrudInfo.ColumnNameCamel}}Request) returns (Update{{.TableName}}By{{.CrudInfo.ColumnNameCamel}}Reply) {
|
||||
option (google.api.http) = {
|
||||
put: "/api/v1/{{.TName}}/left_curly_bracket{{.CrudInfo.ColumnNameCamelFCL}}right_curly_bracket"
|
||||
|
@ -536,14 +535,14 @@ service {{.TName}} {
|
|||
};
|
||||
}
|
||||
|
||||
// get {{.TName}} by {{.CrudInfo.ColumnNameCamelFCL}}
|
||||
// get {{.TName}} details by {{.CrudInfo.ColumnNameCamelFCL}}
|
||||
rpc GetBy{{.CrudInfo.ColumnNameCamel}}(Get{{.TableName}}By{{.CrudInfo.ColumnNameCamel}}Request) returns (Get{{.TableName}}By{{.CrudInfo.ColumnNameCamel}}Reply) {
|
||||
option (google.api.http) = {
|
||||
get: "/api/v1/{{.TName}}/left_curly_bracket{{.CrudInfo.ColumnNameCamelFCL}}right_curly_bracket"
|
||||
};
|
||||
}
|
||||
|
||||
// list of {{.TName}} by query parameters
|
||||
// get a list of {{.TName}} by custom conditions
|
||||
rpc List(List{{.TableName}}Request) returns (List{{.TableName}}Reply) {
|
||||
option (google.api.http) = {
|
||||
post: "/api/v1/{{.TName}}/list"
|
||||
|
@ -567,11 +566,14 @@ If used to generate code that supports the HTTP protocol, notes for defining mes
|
|||
2. If the request url is followed by a query parameter, such as /api/v1/getUserExample?name=Tom,
|
||||
a form tag must be added when defining the query parameter in the message, such as:
|
||||
string name = 1 [(tagger.tags) = "form:\"name\""].
|
||||
3. If the message field name contain underscores(such as 'field_name'), it will cause a problem
|
||||
where the JSON field names of the Swagger request parameters are different from those of the
|
||||
GRPC JSON tag names. There are two solutions: Solution 1, remove the underline from the
|
||||
message field name. Option 2, use the tool 'protoc-go-inject-tag' to modify the JSON tag name,
|
||||
such as: string first_name = 1 ; // @gotags: json:"firstName"
|
||||
3. When the message fields use snake_case naming (e.g., order_id), the generated swagger.json file
|
||||
will use camelCase (e.g., orderId) instead of the expected snake_case. This behavior aligns with
|
||||
the JSON tag names used by gRPC, but it can cause the Gin framework to fail to correctly bind and
|
||||
retrieve parameter values. There are two ways to resolve this issue:
|
||||
(1) Explicitly specify the JSON tag name using the json_name option, such as:
|
||||
string order_id = 1 [json_name = "order_id"];
|
||||
(2) If you want to switch to camelCase naming and update the JSON tag name accordingly, such as:
|
||||
string order_id = 1 [json_name = "orderID", (tagger.tags) = "json:\"orderID\""];
|
||||
*/
|
||||
|
||||
|
||||
|
|
|
@ -105,31 +105,31 @@ import "validate/validate.proto";
|
|||
option go_package = "github.com/go-dev-frame/sponge/api/serverNameExample/v1;v1";
|
||||
|
||||
service {{.TName}} {
|
||||
// create {{.TName}}
|
||||
// create a new {{.TName}}
|
||||
rpc Create(Create{{.TableName}}Request) returns (Create{{.TableName}}Reply) {}
|
||||
|
||||
// delete {{.TName}} by id
|
||||
// delete a {{.TName}} by id
|
||||
rpc DeleteByID(Delete{{.TableName}}ByIDRequest) returns (Delete{{.TableName}}ByIDReply) {}
|
||||
|
||||
// update {{.TName}} by id
|
||||
// update a {{.TName}} by id
|
||||
rpc UpdateByID(Update{{.TableName}}ByIDRequest) returns (Update{{.TableName}}ByIDReply) {}
|
||||
|
||||
// get {{.TName}} by id
|
||||
// get {{.TName}} details by id
|
||||
rpc GetByID(Get{{.TableName}}ByIDRequest) returns (Get{{.TableName}}ByIDReply) {}
|
||||
|
||||
// list of {{.TName}} by query parameters
|
||||
// get a list of {{.TName}} by custom conditions
|
||||
rpc List(List{{.TableName}}Request) returns (List{{.TableName}}Reply) {}
|
||||
|
||||
// delete {{.TName}} by batch id
|
||||
rpc DeleteByIDs(Delete{{.TableName}}ByIDsRequest) returns (Delete{{.TableName}}ByIDsReply) {}
|
||||
|
||||
// get {{.TName}} by condition
|
||||
// get {{.TName}} details by custom condition
|
||||
rpc GetByCondition(Get{{.TableName}}ByConditionRequest) returns (Get{{.TableName}}ByConditionReply) {}
|
||||
|
||||
// list of {{.TName}} by batch id
|
||||
// get a list of {{.TName}} by batch id
|
||||
rpc ListByIDs(List{{.TableName}}ByIDsRequest) returns (List{{.TableName}}ByIDsReply) {}
|
||||
|
||||
// list {{.TName}} by last id
|
||||
// get a list of {{.TName}} by last id
|
||||
rpc ListByLastID(List{{.TableName}}ByLastIDRequest) returns (List{{.TableName}}ByLastIDReply) {}
|
||||
}
|
||||
|
||||
|
@ -228,19 +228,19 @@ import "validate/validate.proto";
|
|||
option go_package = "github.com/go-dev-frame/sponge/api/serverNameExample/v1;v1";
|
||||
|
||||
service {{.TName}} {
|
||||
// create {{.TName}}
|
||||
// create a new {{.TName}}
|
||||
rpc Create(Create{{.TableName}}Request) returns (Create{{.TableName}}Reply) {}
|
||||
|
||||
// delete {{.TName}} by id
|
||||
// delete a {{.TName}} by id
|
||||
rpc DeleteByID(Delete{{.TableName}}ByIDRequest) returns (Delete{{.TableName}}ByIDReply) {}
|
||||
|
||||
// update {{.TName}} by id
|
||||
// update a {{.TName}} by id
|
||||
rpc UpdateByID(Update{{.TableName}}ByIDRequest) returns (Update{{.TableName}}ByIDReply) {}
|
||||
|
||||
// get {{.TName}} by id
|
||||
// get {{.TName}} details by id
|
||||
rpc GetByID(Get{{.TableName}}ByIDRequest) returns (Get{{.TableName}}ByIDReply) {}
|
||||
|
||||
// list of {{.TName}} by query parameters
|
||||
// get a list of {{.TName}} by custom conditions
|
||||
rpc List(List{{.TableName}}Request) returns (List{{.TableName}}Reply) {}
|
||||
}
|
||||
|
||||
|
@ -308,10 +308,8 @@ import "validate/validate.proto";
|
|||
option go_package = "github.com/go-dev-frame/sponge/api/serverNameExample/v1;v1";
|
||||
|
||||
/*
|
||||
Reference https://github.com/grpc-ecosystem/grpc-gateway/blob/db7fbefff7c04877cdb32e16d4a248a024428207/examples/internal/proto/examplepb/a_bit_of_everything.proto
|
||||
Default settings for generating swagger documents
|
||||
NOTE: because json does not support 64 bits, the int64 and uint64 types under *.swagger.json are automatically converted to string types
|
||||
Tips: add swagger option to rpc method, example:
|
||||
Default settings for generating *.swagger.json documents. For reference, see: https://bit.ly/4dE5jj7
|
||||
Tip: To enhance the generated Swagger documentation, you can add the openapiv2_operation option to your RPC method. For example:
|
||||
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
|
||||
summary: "get user by id",
|
||||
description: "get user by id",
|
||||
|
@ -328,7 +326,7 @@ option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_swagger) = {
|
|||
base_path: ""
|
||||
info: {
|
||||
title: "serverNameExample api docs";
|
||||
version: "2.0";
|
||||
version: "v1.0.0";
|
||||
}
|
||||
schemes: HTTP;
|
||||
schemes: HTTPS;
|
||||
|
@ -348,7 +346,7 @@ option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_swagger) = {
|
|||
};
|
||||
|
||||
service {{.TName}} {
|
||||
// create {{.TName}}
|
||||
// create a new {{.TName}}
|
||||
rpc Create(Create{{.TableName}}Request) returns (Create{{.TableName}}Reply) {
|
||||
option (google.api.http) = {
|
||||
post: "/api/v1/{{.TName}}"
|
||||
|
@ -356,14 +354,14 @@ service {{.TName}} {
|
|||
};
|
||||
}
|
||||
|
||||
// delete {{.TName}} by id
|
||||
// delete a {{.TName}} by id
|
||||
rpc DeleteByID(Delete{{.TableName}}ByIDRequest) returns (Delete{{.TableName}}ByIDReply) {
|
||||
option (google.api.http) = {
|
||||
delete: "/api/v1/{{.TName}}/{id}"
|
||||
};
|
||||
}
|
||||
|
||||
// update {{.TName}} by id
|
||||
// update a {{.TName}} by id
|
||||
rpc UpdateByID(Update{{.TableName}}ByIDRequest) returns (Update{{.TableName}}ByIDReply) {
|
||||
option (google.api.http) = {
|
||||
put: "/api/v1/{{.TName}}/{id}"
|
||||
|
@ -371,14 +369,14 @@ service {{.TName}} {
|
|||
};
|
||||
}
|
||||
|
||||
// get {{.TName}} by id
|
||||
// get {{.TName}} details by id
|
||||
rpc GetByID(Get{{.TableName}}ByIDRequest) returns (Get{{.TableName}}ByIDReply) {
|
||||
option (google.api.http) = {
|
||||
get: "/api/v1/{{.TName}}/{id}"
|
||||
};
|
||||
}
|
||||
|
||||
// list of {{.TName}} by query parameters
|
||||
// get a list of {{.TName}} by custom conditions
|
||||
rpc List(List{{.TableName}}Request) returns (List{{.TableName}}Reply) {
|
||||
option (google.api.http) = {
|
||||
post: "/api/v1/{{.TName}}/list"
|
||||
|
@ -394,7 +392,7 @@ service {{.TName}} {
|
|||
};
|
||||
}
|
||||
|
||||
// get {{.TName}} by condition
|
||||
// get {{.TName}} details by custom condition
|
||||
rpc GetByCondition(Get{{.TableName}}ByConditionRequest) returns (Get{{.TableName}}ByConditionReply) {
|
||||
option (google.api.http) = {
|
||||
post: "/api/v1/{{.TName}}/condition"
|
||||
|
@ -402,7 +400,7 @@ service {{.TName}} {
|
|||
};
|
||||
}
|
||||
|
||||
// list of {{.TName}} by batch id
|
||||
// get a list of {{.TName}} by batch id
|
||||
rpc ListByIDs(List{{.TableName}}ByIDsRequest) returns (List{{.TableName}}ByIDsReply) {
|
||||
option (google.api.http) = {
|
||||
post: "/api/v1/{{.TName}}/list/ids"
|
||||
|
@ -410,7 +408,7 @@ service {{.TName}} {
|
|||
};
|
||||
}
|
||||
|
||||
// list {{.TName}} by last id
|
||||
// get a list of {{.TName}} by last id
|
||||
rpc ListByLastID(List{{.TableName}}ByLastIDRequest) returns (List{{.TableName}}ByLastIDReply) {
|
||||
option (google.api.http) = {
|
||||
get: "/api/v1/{{.TName}}/list"
|
||||
|
@ -433,11 +431,14 @@ If used to generate code that supports the HTTP protocol, notes for defining mes
|
|||
2. If the request url is followed by a query parameter, such as /api/v1/getUserExample?name=Tom,
|
||||
a form tag must be added when defining the query parameter in the message, such as:
|
||||
string name = 1 [(tagger.tags) = "form:\"name\""].
|
||||
3. If the message field name contain underscores(such as 'field_name'), it will cause a problem
|
||||
where the JSON field names of the Swagger request parameters are different from those of the
|
||||
GRPC JSON tag names. There are two solutions: Solution 1, remove the underline from the
|
||||
message field name. Option 2, use the tool 'protoc-go-inject-tag' to modify the JSON tag name,
|
||||
such as: string first_name = 1 ; // @gotags: json:"firstName"
|
||||
3. When the message fields use snake_case naming (e.g., order_id), the generated swagger.json file
|
||||
will use camelCase (e.g., orderId) instead of the expected snake_case. This behavior aligns with
|
||||
the JSON tag names used by gRPC, but it can cause the Gin framework to fail to correctly bind and
|
||||
retrieve parameter values. There are two ways to resolve this issue:
|
||||
(1) Explicitly specify the JSON tag name using the json_name option, such as:
|
||||
string order_id = 1 [json_name = "order_id"];
|
||||
(2) If you want to switch to camelCase naming and update the JSON tag name accordingly, such as:
|
||||
string order_id = 1 [json_name = "orderID", (tagger.tags) = "json:\"orderID\""];
|
||||
*/
|
||||
|
||||
|
||||
|
@ -529,10 +530,8 @@ import "validate/validate.proto";
|
|||
option go_package = "github.com/go-dev-frame/sponge/api/serverNameExample/v1;v1";
|
||||
|
||||
/*
|
||||
Reference https://github.com/grpc-ecosystem/grpc-gateway/blob/db7fbefff7c04877cdb32e16d4a248a024428207/examples/internal/proto/examplepb/a_bit_of_everything.proto
|
||||
Default settings for generating swagger documents
|
||||
NOTE: because json does not support 64 bits, the int64 and uint64 types under *.swagger.json are automatically converted to string types
|
||||
Tips: add swagger option to rpc method, example:
|
||||
Default settings for generating *.swagger.json documents. For reference, see: https://bit.ly/4dE5jj7
|
||||
Tip: To enhance the generated Swagger documentation, you can add the openapiv2_operation option to your RPC method. For example:
|
||||
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
|
||||
summary: "get user by id",
|
||||
description: "get user by id",
|
||||
|
@ -549,7 +548,7 @@ option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_swagger) = {
|
|||
base_path: ""
|
||||
info: {
|
||||
title: "serverNameExample api docs";
|
||||
version: "2.0";
|
||||
version: "v1.0.0";
|
||||
}
|
||||
schemes: HTTP;
|
||||
schemes: HTTPS;
|
||||
|
@ -569,7 +568,7 @@ option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_swagger) = {
|
|||
};
|
||||
|
||||
service {{.TName}} {
|
||||
// create {{.TName}}
|
||||
// create a new {{.TName}}
|
||||
rpc Create(Create{{.TableName}}Request) returns (Create{{.TableName}}Reply) {
|
||||
option (google.api.http) = {
|
||||
post: "/api/v1/{{.TName}}"
|
||||
|
@ -577,14 +576,14 @@ service {{.TName}} {
|
|||
};
|
||||
}
|
||||
|
||||
// delete {{.TName}} by id
|
||||
// delete a {{.TName}} by id
|
||||
rpc DeleteByID(Delete{{.TableName}}ByIDRequest) returns (Delete{{.TableName}}ByIDReply) {
|
||||
option (google.api.http) = {
|
||||
delete: "/api/v1/{{.TName}}/{id}"
|
||||
};
|
||||
}
|
||||
|
||||
// update {{.TName}} by id
|
||||
// update a {{.TName}} by id
|
||||
rpc UpdateByID(Update{{.TableName}}ByIDRequest) returns (Update{{.TableName}}ByIDReply) {
|
||||
option (google.api.http) = {
|
||||
put: "/api/v1/{{.TName}}/{id}"
|
||||
|
@ -592,14 +591,14 @@ service {{.TName}} {
|
|||
};
|
||||
}
|
||||
|
||||
// get {{.TName}} by id
|
||||
// get {{.TName}} details by id
|
||||
rpc GetByID(Get{{.TableName}}ByIDRequest) returns (Get{{.TableName}}ByIDReply) {
|
||||
option (google.api.http) = {
|
||||
get: "/api/v1/{{.TName}}/{id}"
|
||||
};
|
||||
}
|
||||
|
||||
// list of {{.TName}} by query parameters
|
||||
// get a list of {{.TName}} by custom conditions
|
||||
rpc List(List{{.TableName}}Request) returns (List{{.TableName}}Reply) {
|
||||
option (google.api.http) = {
|
||||
post: "/api/v1/{{.TName}}/list"
|
||||
|
@ -623,11 +622,14 @@ If used to generate code that supports the HTTP protocol, notes for defining mes
|
|||
2. If the request url is followed by a query parameter, such as /api/v1/getUserExample?name=Tom,
|
||||
a form tag must be added when defining the query parameter in the message, such as:
|
||||
string name = 1 [(tagger.tags) = "form:\"name\""].
|
||||
3. If the message field name contain underscores(such as 'field_name'), it will cause a problem
|
||||
where the JSON field names of the Swagger request parameters are different from those of the
|
||||
GRPC JSON tag names. There are two solutions: Solution 1, remove the underline from the
|
||||
message field name. Option 2, use the tool 'protoc-go-inject-tag' to modify the JSON tag name,
|
||||
such as: string first_name = 1 ; // @gotags: json:"firstName"
|
||||
3. When the message fields use snake_case naming (e.g., order_id), the generated swagger.json file
|
||||
will use camelCase (e.g., orderId) instead of the expected snake_case. This behavior aligns with
|
||||
the JSON tag names used by gRPC, but it can cause the Gin framework to fail to correctly bind and
|
||||
retrieve parameter values. There are two ways to resolve this issue:
|
||||
(1) Explicitly specify the JSON tag name using the json_name option, such as:
|
||||
string order_id = 1 [json_name = "order_id"];
|
||||
(2) If you want to switch to camelCase naming and update the JSON tag name accordingly, such as:
|
||||
string order_id = 1 [json_name = "orderID", (tagger.tags) = "json:\"orderID\""];
|
||||
*/
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue