ShiningRush commented on a change in pull request #486:
URL: https://github.com/apache/apisix-dashboard/pull/486#discussion_r491258262



##########
File path: api/internal/handler/consumer/consumer.go
##########
@@ -0,0 +1,135 @@
+package consumer
+
+import (
+       "reflect"
+       "strings"
+
+       "github.com/gin-gonic/gin"
+       "github.com/shiningrush/droplet"
+       "github.com/shiningrush/droplet/data"
+       "github.com/shiningrush/droplet/wrapper"
+       wgin "github.com/shiningrush/droplet/wrapper/gin"
+
+       "github.com/apisix/manager-api/internal/core/entity"
+       "github.com/apisix/manager-api/internal/core/store"
+       "github.com/apisix/manager-api/internal/handler"
+       "github.com/apisix/manager-api/internal/utils"
+)
+
+type Handler struct {
+       consumerStore *store.GenericStore
+}
+
+func NewHandler() (handler.RouteRegister, error) {
+       s, err := store.NewGenericStore(store.GenericStoreOption{
+               BasePath: "/apisix/consumers",
+               ObjType:  reflect.TypeOf(entity.Consumer{}),
+               KeyFunc: func(obj interface{}) string {
+                       r := obj.(*entity.Consumer)
+                       return r.Username

Review comment:
       I think we should use "ID" as key, keep same as admin api.I will add a 
unique check function for generic store,so you can use it to check username's 
unique.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to