-
Notifications
You must be signed in to change notification settings - Fork 1.6k
/
orm.go
23 lines (18 loc) · 817 Bytes
/
orm.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
package terra
import (
"github.com/smartcontractkit/sqlx"
terradb "github.com/smartcontractkit/chainlink-terra/pkg/terra/db"
"github.com/smartcontractkit/chainlink/core/chains"
"github.com/smartcontractkit/chainlink/core/chains/terra/types"
"github.com/smartcontractkit/chainlink/core/logger"
"github.com/smartcontractkit/chainlink/core/services/pg"
)
// NewORM returns an ORM backed by db.
// https://app.shortcut.com/chainlinklabs/story/33622/remove-legacy-config
func NewORM(db *sqlx.DB, lggr logger.Logger, cfg pg.QConfig) types.ORM {
q := pg.NewQ(db, lggr.Named("ORM"), cfg)
return chains.NewORM[string, *terradb.ChainCfg, terradb.Node](q, "terra", "tendermint_url")
}
func NewORMImmut(cfgs chains.ChainConfig[string, *terradb.ChainCfg, terradb.Node]) types.ORM {
return chains.NewORMImmut(cfgs)
}