2022-11-13 19:17:07 +01:00
|
|
|
package db
|
|
|
|
|
|
|
|
import (
|
2022-11-13 22:31:28 +01:00
|
|
|
"context"
|
2022-12-07 23:32:58 +01:00
|
|
|
"gogs.mikescher.com/BlackForestBytes/goext/sq"
|
2022-11-13 19:17:07 +01:00
|
|
|
)
|
|
|
|
|
2023-01-06 00:39:21 +01:00
|
|
|
type DatabaseImpl interface {
|
2023-01-15 06:30:30 +01:00
|
|
|
DB() sq.DB
|
|
|
|
|
2023-01-06 00:39:21 +01:00
|
|
|
Migrate(ctx context.Context) error
|
|
|
|
Ping(ctx context.Context) error
|
|
|
|
BeginTx(ctx context.Context) (sq.Tx, error)
|
|
|
|
Stop(ctx context.Context) error
|
2022-11-18 21:25:40 +01:00
|
|
|
|
2023-07-27 17:44:06 +02:00
|
|
|
ReadSchema(ctx TxContext) (int, error)
|
2022-11-18 21:25:40 +01:00
|
|
|
|
2023-07-27 17:44:06 +02:00
|
|
|
WriteMetaString(ctx TxContext, key string, value string) error
|
|
|
|
WriteMetaInt(ctx TxContext, key string, value int64) error
|
|
|
|
WriteMetaReal(ctx TxContext, key string, value float64) error
|
|
|
|
WriteMetaBlob(ctx TxContext, key string, value []byte) error
|
2022-11-13 22:31:28 +01:00
|
|
|
|
2023-07-27 17:44:06 +02:00
|
|
|
ReadMetaString(ctx TxContext, key string) (*string, error)
|
|
|
|
ReadMetaInt(ctx TxContext, key string) (*int64, error)
|
|
|
|
ReadMetaReal(ctx TxContext, key string) (*float64, error)
|
|
|
|
ReadMetaBlob(ctx TxContext, key string) (*[]byte, error)
|
2022-12-22 10:21:10 +01:00
|
|
|
|
2023-07-27 17:44:06 +02:00
|
|
|
DeleteMeta(ctx TxContext, key string) error
|
2022-12-22 10:21:10 +01:00
|
|
|
}
|