data.go 459 Bytes
Newer Older
kzkzzzz's avatar
kzkzzzz committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
package data

import (
	"github.com/go-kratos/kratos-layout/internal/conf"
	"github.com/go-kratos/kratos/v2/log"
	"github.com/google/wire"
)

// ProviderSet is data providers.
var ProviderSet = wire.NewSet(NewData, NewGreeterRepo)

// Data .
type Data struct {
	// TODO wrapped database client
}

// NewData .
kzkzzzz's avatar
kzkzzzz committed
18
func NewData(c *conf.Data) (*Data, func(), error) {
kzkzzzz's avatar
kzkzzzz committed
19
	cleanup := func() {
kzkzzzz's avatar
kzkzzzz committed
20
		log.Info("closing the data resources")
kzkzzzz's avatar
kzkzzzz committed
21 22 23
	}
	return &Data{}, cleanup, nil
}