mirror of
https://github.com/go-kratos/kratos.git
synced 2025-03-17 21:07:54 +02:00
fixed test
This commit is contained in:
parent
e1ecc9fa5a
commit
3b510022a3
14
tool/kratos-gen-bts/testdata/dao.bts.go
vendored
14
tool/kratos-gen-bts/testdata/dao.bts.go
vendored
@ -27,12 +27,10 @@ import (
|
||||
"github.com/bilibili/kratos/pkg/sync/errgroup"
|
||||
)
|
||||
|
||||
var (
|
||||
_ _bts
|
||||
)
|
||||
var _ _bts
|
||||
|
||||
// Demos get data from cache if miss will call source method, then add to cache.
|
||||
func (d *Dao) Demos(c context.Context, keys []int64) (res map[int64]*Demo, err error) {
|
||||
func (d *dao) Demos(c context.Context, keys []int64) (res map[int64]*Demo, err error) {
|
||||
if len(keys) == 0 {
|
||||
return
|
||||
}
|
||||
@ -111,7 +109,7 @@ func (d *Dao) Demos(c context.Context, keys []int64) (res map[int64]*Demo, err e
|
||||
}
|
||||
|
||||
// Demos1 get data from cache if miss will call source method, then add to cache.
|
||||
func (d *Dao) Demos1(c context.Context, keys []int64) (res map[int64]*Demo, err error) {
|
||||
func (d *dao) Demos1(c context.Context, keys []int64) (res map[int64]*Demo, err error) {
|
||||
if len(keys) == 0 {
|
||||
return
|
||||
}
|
||||
@ -190,7 +188,7 @@ func (d *Dao) Demos1(c context.Context, keys []int64) (res map[int64]*Demo, err
|
||||
}
|
||||
|
||||
// Demo get data from cache if miss will call source method, then add to cache.
|
||||
func (d *Dao) Demo(c context.Context, key int64) (res *Demo, err error) {
|
||||
func (d *dao) Demo(c context.Context, key int64) (res *Demo, err error) {
|
||||
addCache := true
|
||||
res, err = d.CacheDemo(c, key)
|
||||
if err != nil {
|
||||
@ -223,7 +221,7 @@ func (d *Dao) Demo(c context.Context, key int64) (res *Demo, err error) {
|
||||
}
|
||||
|
||||
// Demo1 get data from cache if miss will call source method, then add to cache.
|
||||
func (d *Dao) Demo1(c context.Context, key int64, pn int, ps int) (res *Demo, err error) {
|
||||
func (d *dao) Demo1(c context.Context, key int64, pn int, ps int) (res *Demo, err error) {
|
||||
addCache := true
|
||||
res, err = d.CacheDemo1(c, key, pn, ps)
|
||||
if err != nil {
|
||||
@ -250,7 +248,7 @@ func (d *Dao) Demo1(c context.Context, key int64, pn int, ps int) (res *Demo, er
|
||||
}
|
||||
|
||||
// None get data from cache if miss will call source method, then add to cache.
|
||||
func (d *Dao) None(c context.Context) (res *Demo, err error) {
|
||||
func (d *dao) None(c context.Context) (res *Demo, err error) {
|
||||
addCache := true
|
||||
res, err = d.CacheNone(c)
|
||||
if err != nil {
|
||||
|
6
tool/kratos-gen-bts/testdata/dao.go
vendored
6
tool/kratos-gen-bts/testdata/dao.go
vendored
@ -13,13 +13,13 @@ type Demo struct {
|
||||
}
|
||||
|
||||
// Dao .
|
||||
type Dao struct {
|
||||
type dao struct {
|
||||
cache *fanout.Fanout
|
||||
}
|
||||
|
||||
// New .
|
||||
func New() *Dao {
|
||||
return &Dao{cache: fanout.New("cache")}
|
||||
func New() *dao {
|
||||
return &dao{cache: fanout.New("cache")}
|
||||
}
|
||||
|
||||
//go:generate kratos tool genbts
|
||||
|
12
tool/kratos-gen-bts/testdata/multi.go
vendored
12
tool/kratos-gen-bts/testdata/multi.go
vendored
@ -12,37 +12,37 @@ var (
|
||||
)
|
||||
|
||||
// CacheDemos .
|
||||
func (d *Dao) CacheDemos(c context.Context, keys []int64) (map[int64]*Demo, error) {
|
||||
func (d *dao) CacheDemos(c context.Context, keys []int64) (map[int64]*Demo, error) {
|
||||
// get data from cache
|
||||
return _multiCacheFunc(c, keys)
|
||||
}
|
||||
|
||||
// RawDemos .
|
||||
func (d *Dao) RawDemos(c context.Context, keys []int64) (map[int64]*Demo, error) {
|
||||
func (d *dao) RawDemos(c context.Context, keys []int64) (map[int64]*Demo, error) {
|
||||
// get data from db
|
||||
return _multiRawFunc(c, keys)
|
||||
}
|
||||
|
||||
// AddCacheDemos .
|
||||
func (d *Dao) AddCacheDemos(c context.Context, values map[int64]*Demo) error {
|
||||
func (d *dao) AddCacheDemos(c context.Context, values map[int64]*Demo) error {
|
||||
// add to cache
|
||||
return _multiAddCacheFunc(c, values)
|
||||
}
|
||||
|
||||
// CacheDemos1 .
|
||||
func (d *Dao) CacheDemos1(c context.Context, keys []int64) (map[int64]*Demo, error) {
|
||||
func (d *dao) CacheDemos1(c context.Context, keys []int64) (map[int64]*Demo, error) {
|
||||
// get data from cache
|
||||
return _multiCacheFunc(c, keys)
|
||||
}
|
||||
|
||||
// RawDemos .
|
||||
func (d *Dao) RawDemos1(c context.Context, keys []int64) (map[int64]*Demo, error) {
|
||||
func (d *dao) RawDemos1(c context.Context, keys []int64) (map[int64]*Demo, error) {
|
||||
// get data from db
|
||||
return _multiRawFunc(c, keys)
|
||||
}
|
||||
|
||||
// AddCacheDemos .
|
||||
func (d *Dao) AddCacheDemos1(c context.Context, values map[int64]*Demo) error {
|
||||
func (d *dao) AddCacheDemos1(c context.Context, values map[int64]*Demo) error {
|
||||
// add to cache
|
||||
return _multiAddCacheFunc(c, values)
|
||||
}
|
||||
|
6
tool/kratos-gen-bts/testdata/none.go
vendored
6
tool/kratos-gen-bts/testdata/none.go
vendored
@ -12,19 +12,19 @@ var (
|
||||
)
|
||||
|
||||
// CacheNone .
|
||||
func (d *Dao) CacheNone(c context.Context) (*Demo, error) {
|
||||
func (d *dao) CacheNone(c context.Context) (*Demo, error) {
|
||||
// get data from cache
|
||||
return _noneCacheFunc(c)
|
||||
}
|
||||
|
||||
// RawNone .
|
||||
func (d *Dao) RawNone(c context.Context) (*Demo, error) {
|
||||
func (d *dao) RawNone(c context.Context) (*Demo, error) {
|
||||
// get data from db
|
||||
return _noneRawFunc(c)
|
||||
}
|
||||
|
||||
// AddCacheNone .
|
||||
func (d *Dao) AddCacheNone(c context.Context, value *Demo) error {
|
||||
func (d *dao) AddCacheNone(c context.Context, value *Demo) error {
|
||||
// add to cache
|
||||
return _noneAddCacheFunc(c, value)
|
||||
}
|
||||
|
12
tool/kratos-gen-bts/testdata/single.go
vendored
12
tool/kratos-gen-bts/testdata/single.go
vendored
@ -12,37 +12,37 @@ var (
|
||||
)
|
||||
|
||||
// CacheDemo .
|
||||
func (d *Dao) CacheDemo(c context.Context, key int64) (*Demo, error) {
|
||||
func (d *dao) CacheDemo(c context.Context, key int64) (*Demo, error) {
|
||||
// get data from cache
|
||||
return _singleCacheFunc(c, key)
|
||||
}
|
||||
|
||||
// RawDemo .
|
||||
func (d *Dao) RawDemo(c context.Context, key int64) (*Demo, error) {
|
||||
func (d *dao) RawDemo(c context.Context, key int64) (*Demo, error) {
|
||||
// get data from db
|
||||
return _singleRawFunc(c, key)
|
||||
}
|
||||
|
||||
// AddCacheDemo .
|
||||
func (d *Dao) AddCacheDemo(c context.Context, key int64, value *Demo) error {
|
||||
func (d *dao) AddCacheDemo(c context.Context, key int64, value *Demo) error {
|
||||
// add to cache
|
||||
return _singleAddCacheFunc(c, key, value)
|
||||
}
|
||||
|
||||
// CacheDemo1 .
|
||||
func (d *Dao) CacheDemo1(c context.Context, key int64, pn, ps int) (*Demo, error) {
|
||||
func (d *dao) CacheDemo1(c context.Context, key int64, pn, ps int) (*Demo, error) {
|
||||
// get data from cache
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
// RawDemo1 .
|
||||
func (d *Dao) RawDemo1(c context.Context, key int64, pn, ps int) (*Demo, *Demo, error) {
|
||||
func (d *dao) RawDemo1(c context.Context, key int64, pn, ps int) (*Demo, *Demo, error) {
|
||||
// get data from db
|
||||
return nil, nil, nil
|
||||
}
|
||||
|
||||
// AddCacheDemo1 .
|
||||
func (d *Dao) AddCacheDemo1(c context.Context, key int64, value *Demo, pn, ps int) error {
|
||||
func (d *dao) AddCacheDemo1(c context.Context, key int64, value *Demo, pn, ps int) error {
|
||||
// add to cache
|
||||
return nil
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user