dao.go 650 B

1234567891011121314151617181920212223242526272829303132
  1. package sidebar
  2. import (
  3. "context"
  4. "go-common/app/interface/main/app-interface/conf"
  5. resmodel "go-common/app/service/main/resource/model"
  6. resrpc "go-common/app/service/main/resource/rpc/client"
  7. "github.com/pkg/errors"
  8. )
  9. // Dao is sidebar dao
  10. type Dao struct {
  11. resRPC *resrpc.Service
  12. }
  13. // New initial sidebar dao
  14. func New(c *conf.Config) (d *Dao) {
  15. d = &Dao{
  16. resRPC: resrpc.New(c.ResourceRPC),
  17. }
  18. return
  19. }
  20. // Sidebars from resource service
  21. func (d *Dao) Sidebars(c context.Context) (res *resmodel.SideBars, err error) {
  22. if res, err = d.resRPC.SideBars(c); err != nil {
  23. err = errors.Wrapf(err, "d.resRPC.SideBars(%+v)")
  24. }
  25. return
  26. }