diff --git a/tool/kratos-gen-bts/testdata/dao.bts.go b/tool/kratos-gen-bts/testdata/dao.bts.go index 4b8f0096c..ced05553b 100644 --- a/tool/kratos-gen-bts/testdata/dao.bts.go +++ b/tool/kratos-gen-bts/testdata/dao.bts.go @@ -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 { diff --git a/tool/kratos-gen-bts/testdata/dao.go b/tool/kratos-gen-bts/testdata/dao.go index 6e1f5aece..e3e68edfc 100644 --- a/tool/kratos-gen-bts/testdata/dao.go +++ b/tool/kratos-gen-bts/testdata/dao.go @@ -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 diff --git a/tool/kratos-gen-bts/testdata/multi.go b/tool/kratos-gen-bts/testdata/multi.go index b398adb67..4685d37ef 100644 --- a/tool/kratos-gen-bts/testdata/multi.go +++ b/tool/kratos-gen-bts/testdata/multi.go @@ -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) } diff --git a/tool/kratos-gen-bts/testdata/none.go b/tool/kratos-gen-bts/testdata/none.go index b504c9c79..c3202613a 100644 --- a/tool/kratos-gen-bts/testdata/none.go +++ b/tool/kratos-gen-bts/testdata/none.go @@ -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) } diff --git a/tool/kratos-gen-bts/testdata/single.go b/tool/kratos-gen-bts/testdata/single.go index db7c13c55..fe390216a 100644 --- a/tool/kratos-gen-bts/testdata/single.go +++ b/tool/kratos-gen-bts/testdata/single.go @@ -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 }