소스 검색

添加接口

yjp 1 년 전
부모
커밋
60ee877aae
1개의 변경된 파일60개의 추가작업 그리고 0개의 파일을 삭제
  1. 60 0
      framework/gateway/builder.go

+ 60 - 0
framework/gateway/builder.go

@@ -84,6 +84,16 @@ func (builder *Builder) PostRouteWithTenantIDAndUserID(relativePath string, hand
 	builder.AddRouteWithTenantIDAndUserID(http.MethodPost, relativePath, "tenantId", "userId", handler, middlewares...)
 }
 
+// PostRouteWithTenantIDAndCreateUserID 创建POST网关API,请求Body是JsonBody,且会添加租户ID和用户ID字段,字段名分别为tenantId和createUserId
+// 参数:
+// - relativePath: 该网关API的相对URL
+// - handler: 该网关API处理函数
+// - middlewares: 该网关API的中间件
+// 返回值: 无
+func (builder *Builder) PostRouteWithTenantIDAndCreateUserID(relativePath string, handler Handler, middlewares ...Handler) {
+	builder.AddRouteWithTenantIDAndUserID(http.MethodPost, relativePath, "tenantId", "createUserId", handler, middlewares...)
+}
+
 // DeleteRouteWithTenantIDAndUserID 创建DELETE网关API,会在查询参数添加租户ID和用户ID字段,字段名分别为tenantId和userId
 // 参数:
 // - relativePath: 该网关API的相对URL
@@ -94,6 +104,16 @@ func (builder *Builder) DeleteRouteWithTenantIDAndUserID(relativePath string, ha
 	builder.AddRouteWithTenantIDAndUserID(http.MethodDelete, relativePath, "tenantId", "userId", handler, middlewares...)
 }
 
+// DeleteRouteWithTenantIDAndDeleteUserID 创建DELETE网关API,会在查询参数添加租户ID和用户ID字段,字段名分别为tenantId和deleteUserId
+// 参数:
+// - relativePath: 该网关API的相对URL
+// - handler: 该网关API处理函数
+// - middlewares: 该网关API的中间件
+// 返回值: 无
+func (builder *Builder) DeleteRouteWithTenantIDAndDeleteUserID(relativePath string, handler Handler, middlewares ...Handler) {
+	builder.AddRouteWithTenantIDAndUserID(http.MethodDelete, relativePath, "tenantId", "deleteUserId", handler, middlewares...)
+}
+
 // PutRouteWithTenantIDAndUserID 创建PUT网关API,请求Body是JsonBody,且会添加租户ID和用户ID字段,字段名分别为tenantId和userId
 // 参数:
 // - relativePath: 该网关API的相对URL
@@ -104,6 +124,16 @@ func (builder *Builder) PutRouteWithTenantIDAndUserID(relativePath string, handl
 	builder.AddRouteWithTenantIDAndUserID(http.MethodPut, relativePath, "tenantId", "userId", handler, middlewares...)
 }
 
+// PutRouteWithTenantIDAndUpdateUserID 创建PUT网关API,请求Body是JsonBody,且会添加租户ID和用户ID字段,字段名分别为tenantId和updateUserId
+// 参数:
+// - relativePath: 该网关API的相对URL
+// - handler: 该网关API处理函数
+// - middlewares: 该网关API的中间件
+// 返回值: 无
+func (builder *Builder) PutRouteWithTenantIDAndUpdateUserID(relativePath string, handler Handler, middlewares ...Handler) {
+	builder.AddRouteWithTenantIDAndUserID(http.MethodPut, relativePath, "tenantId", "updateUserId", handler, middlewares...)
+}
+
 // GetRouteWithTenantIDAndUserID 创建GET网关API,会在查询参数添加租户ID和用户ID字段,字段名分别为tenantId和userId
 // 参数:
 // - relativePath: 该网关API的相对URL
@@ -164,6 +194,16 @@ func (builder *Builder) PostRouteWithUserID(relativePath string, handler Handler
 	builder.AddRouteWithTenantIDAndUserID(http.MethodPost, relativePath, "", "userId", handler, middlewares...)
 }
 
+// PostRouteWithCreateUserID 创建POST网关API,请求Body是JsonBody,且会添加用户ID字段,字段名分别为createUserId
+// 参数:
+// - relativePath: 该网关API的相对URL
+// - handler: 该网关API处理函数
+// - middlewares: 该网关API的中间件
+// 返回值: 无
+func (builder *Builder) PostRouteWithCreateUserID(relativePath string, handler Handler, middlewares ...Handler) {
+	builder.AddRouteWithTenantIDAndUserID(http.MethodPost, relativePath, "", "createUserId", handler, middlewares...)
+}
+
 // DeleteRouteWithUserID 创建DELETE网关API,会在查询参数添加用户ID字段,字段名分别为userId
 // 参数:
 // - relativePath: 该网关API的相对URL
@@ -174,6 +214,16 @@ func (builder *Builder) DeleteRouteWithUserID(relativePath string, handler Handl
 	builder.AddRouteWithTenantIDAndUserID(http.MethodDelete, relativePath, "", "userId", handler, middlewares...)
 }
 
+// DeleteRouteWithDeleteUserID 创建DELETE网关API,会在查询参数添加用户ID字段,字段名分别为deleteUserId
+// 参数:
+// - relativePath: 该网关API的相对URL
+// - handler: 该网关API处理函数
+// - middlewares: 该网关API的中间件
+// 返回值: 无
+func (builder *Builder) DeleteRouteWithDeleteUserID(relativePath string, handler Handler, middlewares ...Handler) {
+	builder.AddRouteWithTenantIDAndUserID(http.MethodDelete, relativePath, "", "deleteUserId", handler, middlewares...)
+}
+
 // PutRouteWithUserID 创建PUT网关API,请求Body是JsonBody,且会添加用户ID字段,字段名分别为userId
 // 参数:
 // - relativePath: 该网关API的相对URL
@@ -184,6 +234,16 @@ func (builder *Builder) PutRouteWithUserID(relativePath string, handler Handler,
 	builder.AddRouteWithTenantIDAndUserID(http.MethodPut, relativePath, "", "userId", handler, middlewares...)
 }
 
+// PutRouteWithUpdateUserID 创建PUT网关API,请求Body是JsonBody,且会添加用户ID字段,字段名分别为updateUserId
+// 参数:
+// - relativePath: 该网关API的相对URL
+// - handler: 该网关API处理函数
+// - middlewares: 该网关API的中间件
+// 返回值: 无
+func (builder *Builder) PutRouteWithUpdateUserID(relativePath string, handler Handler, middlewares ...Handler) {
+	builder.AddRouteWithTenantIDAndUserID(http.MethodPut, relativePath, "", "updateUserId", handler, middlewares...)
+}
+
 // GetRouteWithUserID 创建GET网关API,会在查询参数添加用户ID字段,字段名分别为userId
 // 参数:
 // - relativePath: 该网关API的相对URL