20 lines
327 B
Go
20 lines
327 B
Go
package adminfinance
|
|
|
|
import (
|
|
"github.com/redis/go-redis/v9"
|
|
"gorm.io/gorm"
|
|
)
|
|
|
|
type Repository struct {
|
|
db *gorm.DB
|
|
redis *redis.Client
|
|
}
|
|
|
|
func NewRepository(db *gorm.DB, redisClient ...*redis.Client) *Repository {
|
|
repo := &Repository{db: db}
|
|
if len(redisClient) > 0 {
|
|
repo.redis = redisClient[0]
|
|
}
|
|
return repo
|
|
}
|