single.go 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. package testdata
  2. import (
  3. "context"
  4. )
  5. // mock test
  6. var (
  7. _singleCacheFunc func(c context.Context, key int64) (*Article, error)
  8. _singleRawFunc func(c context.Context, key int64) (*Article, error)
  9. _singleAddCacheFunc func(c context.Context, key int64, value *Article) error
  10. )
  11. // CacheArticle .
  12. func (d *Dao) CacheArticle(c context.Context, key int64) (*Article, error) {
  13. // get data from cache
  14. return _singleCacheFunc(c, key)
  15. }
  16. // RawArticle .
  17. func (d *Dao) RawArticle(c context.Context, key int64) (*Article, error) {
  18. // get data from db
  19. return _singleRawFunc(c, key)
  20. }
  21. // AddCacheArticle .
  22. func (d *Dao) AddCacheArticle(c context.Context, key int64, value *Article) error {
  23. // add to cache
  24. return _singleAddCacheFunc(c, key, value)
  25. }
  26. // CacheArticle1 .
  27. func (d *Dao) CacheArticle1(c context.Context, key int64, pn, ps int) (*Article, error) {
  28. // get data from cache
  29. return nil, nil
  30. }
  31. // RawArticle1 .
  32. func (d *Dao) RawArticle1(c context.Context, key int64, pn, ps int) (*Article, *Article, error) {
  33. // get data from db
  34. return nil, nil, nil
  35. }
  36. // AddCacheArticle1 .
  37. func (d *Dao) AddCacheArticle1(c context.Context, key int64, value *Article, pn, ps int) error {
  38. // add to cache
  39. return nil
  40. }