mirror of
https://github.com/kevin-DL/services.git
synced 2026-01-11 19:04:35 +00:00
Micro dep bump to fix api docs (#147)
This commit is contained in:
@@ -10,6 +10,7 @@ import (
|
||||
|
||||
"github.com/google/uuid"
|
||||
"github.com/micro/micro/v3/service/errors"
|
||||
"github.com/micro/micro/v3/service/logger"
|
||||
db "github.com/micro/services/db/proto"
|
||||
gorm2 "github.com/micro/services/pkg/gorm"
|
||||
"github.com/micro/services/pkg/tenant"
|
||||
@@ -53,6 +54,7 @@ func (e *Db) Create(ctx context.Context, req *db.CreateRequest, rsp *db.CreateRe
|
||||
if !re.Match([]byte(tableName)) {
|
||||
return errors.BadRequest("db.create", fmt.Sprintf("table name %v is invalid", req.Table))
|
||||
}
|
||||
logger.Infof("Inserting into table '%v'", tableName)
|
||||
|
||||
db, err := e.GetDBConn(ctx)
|
||||
if err != nil {
|
||||
@@ -60,6 +62,7 @@ func (e *Db) Create(ctx context.Context, req *db.CreateRequest, rsp *db.CreateRe
|
||||
}
|
||||
_, ok = c.Get(tableName)
|
||||
if !ok {
|
||||
logger.Infof("Creating table '%v'", tableName)
|
||||
db.Exec(fmt.Sprintf(stmt, tableName))
|
||||
c.Set(tableName, true, 0)
|
||||
}
|
||||
@@ -100,6 +103,8 @@ func (e *Db) Update(ctx context.Context, req *db.UpdateRequest, rsp *db.UpdateRe
|
||||
if !re.Match([]byte(tableName)) {
|
||||
return errors.BadRequest("db.create", fmt.Sprintf("table name %v is invalid", req.Table))
|
||||
}
|
||||
logger.Infof("Updating table '%v'", tableName)
|
||||
|
||||
db, err := e.GetDBConn(ctx)
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -155,6 +160,8 @@ func (e *Db) Read(ctx context.Context, req *db.ReadRequest, rsp *db.ReadResponse
|
||||
}
|
||||
tenantId = strings.Replace(strings.Replace(tenantId, "/", "_", -1), "-", "_", -1)
|
||||
tableName := tenantId + "_" + req.Table
|
||||
logger.Infof("Reading table '%v'", tableName)
|
||||
|
||||
if !re.Match([]byte(tableName)) {
|
||||
return errors.BadRequest("db.create", fmt.Sprintf("table name %v is invalid", req.Table))
|
||||
}
|
||||
@@ -232,6 +239,7 @@ func (e *Db) Delete(ctx context.Context, req *db.DeleteRequest, rsp *db.DeleteRe
|
||||
if !re.Match([]byte(tableName)) {
|
||||
return errors.BadRequest("db.create", fmt.Sprintf("table name %v is invalid", req.Table))
|
||||
}
|
||||
logger.Infof("Deleting from table '%v'", tableName)
|
||||
|
||||
db, err := e.GetDBConn(ctx)
|
||||
if err != nil {
|
||||
|
||||
2
go.mod
2
go.mod
@@ -22,7 +22,7 @@ require (
|
||||
github.com/mattheath/base62 v0.0.0-20150408093626-b80cdc656a7a // indirect
|
||||
github.com/mattheath/kala v0.0.0-20171219141654-d6276794bf0e
|
||||
github.com/micro/dev v0.0.0-20201117163752-d3cfc9788dfa
|
||||
github.com/micro/micro/v3 v3.2.2-0.20210607154842-ec8964031a93
|
||||
github.com/micro/micro/v3 v3.3.1-0.20210610124047-81b204838fbf
|
||||
github.com/miekg/dns v1.1.31 // indirect
|
||||
github.com/onsi/ginkgo v1.15.0 // indirect
|
||||
github.com/oschwald/geoip2-golang v1.5.0
|
||||
|
||||
2
go.sum
2
go.sum
@@ -349,6 +349,8 @@ github.com/micro/dev v0.0.0-20201117163752-d3cfc9788dfa/go.mod h1:j/8E+ezN/ij7a9
|
||||
github.com/micro/micro/v3 v3.0.0-beta.6.0.20201016094841-ca8ffd563b2b/go.mod h1:RPJTp9meQAppzW/9jgQtfJmPpRJAySVPbz9uur4B3Ko=
|
||||
github.com/micro/micro/v3 v3.2.2-0.20210607154842-ec8964031a93 h1:ZBPbH/Q3UaC69j+SQghgAHbskt+z+Lsw0eygJfoPz/Y=
|
||||
github.com/micro/micro/v3 v3.2.2-0.20210607154842-ec8964031a93/go.mod h1:0NVo+HuGK22cbFqkLe59rGZZeXh2++XBfhU+xheOh8g=
|
||||
github.com/micro/micro/v3 v3.3.1-0.20210610124047-81b204838fbf h1:DmZxpZRiRmHewlvMML+QfwQK6H4K9fKLZwTxhh3eBM4=
|
||||
github.com/micro/micro/v3 v3.3.1-0.20210610124047-81b204838fbf/go.mod h1:0NVo+HuGK22cbFqkLe59rGZZeXh2++XBfhU+xheOh8g=
|
||||
github.com/miekg/dns v1.1.15/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg=
|
||||
github.com/miekg/dns v1.1.27/go.mod h1:KNUDUusw/aVsxyTYZM1oqvCicbwhgbNgztCETuNZ7xM=
|
||||
github.com/miekg/dns v1.1.31 h1:sJFOl9BgwbYAWOGEwr61FU28pqsBNdpRBnhGXtO06Oo=
|
||||
|
||||
Reference in New Issue
Block a user