databse provider
This commit is contained in:
@@ -1,5 +1,11 @@
|
||||
ignores:
|
||||
- migrations
|
||||
- river_client
|
||||
- river_client_queue
|
||||
- river_job
|
||||
- river_leader
|
||||
- river_migration
|
||||
- river_queue
|
||||
imports:
|
||||
- go.ipao.vip/gen
|
||||
field_type:
|
||||
|
||||
@@ -5,6 +5,14 @@ import (
|
||||
"database/sql"
|
||||
"embed"
|
||||
"fmt"
|
||||
|
||||
"{{.ModuleName}}/database/models"
|
||||
|
||||
"github.com/rogeecn/atom"
|
||||
"go.ipao.vip/atom/container/container"
|
||||
"go.ipao.vip/atom/contracts/contracts"
|
||||
"go.ipao.vip/atom/opt/opt"
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
//go:embed migrations/*
|
||||
@@ -31,3 +39,17 @@ func WrapLikeLeft(v string) string {
|
||||
func WrapLikeRight(v string) string {
|
||||
return "%" + v
|
||||
}
|
||||
|
||||
func Provide(...opt.Option) error {
|
||||
return container.Container.Provide(func(db *gorm.DB) contracts.Initial {
|
||||
models.SetDefault(db)
|
||||
return models.Q
|
||||
}, atom.GroupInitial)
|
||||
}
|
||||
|
||||
func DefaultProvider() container.ProviderContainer {
|
||||
return container.ProviderContainer{
|
||||
Provider: Provide,
|
||||
Options: []opt.Option{},
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,54 @@
|
||||
module {{.ModuleName}}
|
||||
|
||||
go 1.22.0
|
||||
|
||||
require (
|
||||
github.com/ThreeDotsLabs/watermill v1.5.1
|
||||
github.com/ThreeDotsLabs/watermill-kafka/v3 v3.1.1
|
||||
github.com/ThreeDotsLabs/watermill-redisstream v1.4.4
|
||||
github.com/ThreeDotsLabs/watermill-sql/v3 v3.1.0
|
||||
github.com/gofiber/fiber/v3 v3.0.0-rc.1
|
||||
github.com/gofiber/utils/v2 v2.0.0-rc.1
|
||||
github.com/golang-jwt/jwt/v4 v4.5.2
|
||||
github.com/imroc/req/v3 v3.55.0
|
||||
github.com/jackc/pgx/v5 v5.7.6
|
||||
github.com/juju/go4 v0.0.0-20160222163258-40d72ab9641a
|
||||
github.com/lib/pq v1.10.9
|
||||
github.com/opentracing/opentracing-go v1.2.0
|
||||
github.com/pkg/errors v0.9.1
|
||||
github.com/pressly/goose/v3 v3.25.0
|
||||
github.com/redis/go-redis/v9 v9.13.0
|
||||
github.com/riverqueue/river v0.24.0
|
||||
github.com/riverqueue/river/riverdriver/riverdatabasesql v0.24.0
|
||||
github.com/riverqueue/river/riverdriver/riverpgxv5 v0.24.0
|
||||
github.com/riverqueue/river/rivertype v0.24.0
|
||||
github.com/rogeecn/fabfile v1.7.0
|
||||
github.com/rogeecn/swag v1.0.1
|
||||
github.com/samber/lo v1.51.0
|
||||
github.com/sirupsen/logrus v1.9.3
|
||||
github.com/smartystreets/goconvey v1.8.1
|
||||
github.com/soheilhy/cmux v0.1.5
|
||||
github.com/speps/go-hashids/v2 v2.0.1
|
||||
github.com/spf13/cobra v1.10.1
|
||||
github.com/stretchr/testify v1.11.1
|
||||
github.com/swaggo/files/v2 v2.0.2
|
||||
github.com/uber/jaeger-client-go v2.30.0+incompatible
|
||||
go.ipao.vip/atom v1.1.8
|
||||
go.opentelemetry.io/contrib/instrumentation/runtime v0.63.0
|
||||
go.opentelemetry.io/otel v1.38.0
|
||||
go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v1.38.0
|
||||
go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp v1.38.0
|
||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.38.0
|
||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.38.0
|
||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.38.0
|
||||
go.opentelemetry.io/otel/metric v1.38.0
|
||||
go.opentelemetry.io/otel/sdk v1.38.0
|
||||
go.opentelemetry.io/otel/sdk/metric v1.38.0
|
||||
go.opentelemetry.io/otel/trace v1.38.0
|
||||
go.uber.org/dig v1.19.0
|
||||
golang.org/x/net v0.44.0
|
||||
golang.org/x/sync v0.17.0
|
||||
google.golang.org/grpc v1.75.0
|
||||
google.golang.org/protobuf v1.36.9
|
||||
gopkg.in/retry.v1 v1.0.3
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user