Documentation
¶
Index ¶
- Constants
- func Default() ctx.ServicePackage
- func IsErrNotFound(err error) bool
- func SessionContextReturning[T any](context context.Context, connection Connection, ...) (T, error)
- func SessionContextStream[T any](ctx context.Context, connection Connection, fetchSize int, ...) channels.StreamingChan[T]
- func SessionContextTxReturning[T any](context context.Context, connection Connection, ...) (T, error)
- func SessionReturning[T any](connection Connection, sessionFn func(session *Session) (T, error)) (T, error)
- func SessionStream[T any](connection Connection, fetchSize int, selectFn func(session *gorm.DB) *gorm.DB) channels.StreamingChan[T]
- func SessionTxReturning[T any](connection Connection, txFn func(session *Session) (T, error)) (T, error)
- func TxReturning[T any](session *Session, txFn func(session *Session) (T, error)) (T, error)
- type Connection
- type Paginator
- type Session
Constants ¶
View Source
const DefaultFetchSize = 1000
Variables ¶
This section is empty.
Functions ¶
func Default ¶
func Default() ctx.ServicePackage
func IsErrNotFound ¶
func SessionContextReturning ¶
func SessionContextStream ¶ added in v0.3.2
func SessionReturning ¶
func SessionReturning[T any](connection Connection, sessionFn func(session *Session) (T, error)) (T, error)
func SessionStream ¶ added in v0.3.2
func SessionStream[T any](connection Connection, fetchSize int, selectFn func(session *gorm.DB) *gorm.DB) channels.StreamingChan[T]
func SessionTxReturning ¶
func SessionTxReturning[T any](connection Connection, txFn func(session *Session) (T, error)) (T, error)
Types ¶
type Connection ¶
type Connection interface {
Init() error
AutoMigrate(models ...any)
Session(session func(session *Session) error) error
SessionContext(context context.Context, session func(session *Session) error) error
Stats() (sql.DBStats, error)
Check() error
Health() health.ServiceHealth
}
func NewConnection ¶
func NewConnection(name string, configPrefix string, isDefault bool, isCritical bool) Connection
Click to show internal directories.
Click to hide internal directories.