package db

import (
	"context"

	"gorm.io/gorm"
)

type Provider interface {
	ReadDB(ctx context.Context) *gorm.DB
	WriteDB(ctx context.Context) *gorm.DB
}

// Transactioner provide the ability to start a transaction
type Transactioner interface {
	Transaction(ctx context.Context, cb func(ctx context.Context) error) error
}

// TransProvider provide DB handle and the transaction
type TransProvider interface {
	Provider
	Transactioner
}
