abstract_sql

package
v0.0.0-...-45e1a9a Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 15, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DEFAULT_TABLE = "filemeta"
)

Variables

This section is empty.

Functions

func GenDirAndName

func GenDirAndName(key []byte) (dirStr string, dirHash int64, name string)

Types

type AbstractSqlStore

type AbstractSqlStore struct {
	SqlGenerator
	DB                 *sql.DB
	SupportBucketTable bool
	// contains filtered or unexported fields
}

func (*AbstractSqlStore) BeginTransaction

func (store *AbstractSqlStore) BeginTransaction(ctx context.Context) (context.Context, error)

func (*AbstractSqlStore) CanDropWholeBucket

func (store *AbstractSqlStore) CanDropWholeBucket() bool

func (*AbstractSqlStore) CommitTransaction

func (store *AbstractSqlStore) CommitTransaction(ctx context.Context) error

func (*AbstractSqlStore) CreateTable

func (store *AbstractSqlStore) CreateTable(ctx context.Context, bucket string) error

func (*AbstractSqlStore) DeleteEntry

func (store *AbstractSqlStore) DeleteEntry(ctx context.Context, fullpath util.FullPath) error

func (*AbstractSqlStore) DeleteFolderChildren

func (store *AbstractSqlStore) DeleteFolderChildren(ctx context.Context, fullpath util.FullPath) error

func (*AbstractSqlStore) FindEntry

func (store *AbstractSqlStore) FindEntry(ctx context.Context, fullpath util.FullPath) (*filer.Entry, error)

func (*AbstractSqlStore) InsertEntry

func (store *AbstractSqlStore) InsertEntry(ctx context.Context, entry *filer.Entry) (err error)

func (*AbstractSqlStore) KvDelete

func (store *AbstractSqlStore) KvDelete(ctx context.Context, key []byte) (err error)

func (*AbstractSqlStore) KvGet

func (store *AbstractSqlStore) KvGet(ctx context.Context, key []byte) (value []byte, err error)

func (*AbstractSqlStore) KvPut

func (store *AbstractSqlStore) KvPut(ctx context.Context, key []byte, value []byte) (err error)

func (*AbstractSqlStore) ListDirectoryEntries

func (store *AbstractSqlStore) ListDirectoryEntries(ctx context.Context, dirPath util.FullPath, startFileName string, includeStartFile bool, limit int64, eachEntryFunc filer.ListEachEntryFunc) (lastFileName string, err error)

func (*AbstractSqlStore) ListDirectoryPrefixedEntries

func (store *AbstractSqlStore) ListDirectoryPrefixedEntries(ctx context.Context, dirPath util.FullPath, startFileName string, includeStartFile bool, limit int64, prefix string, eachEntryFunc filer.ListEachEntryFunc) (lastFileName string, err error)

func (*AbstractSqlStore) OnBucketCreation

func (store *AbstractSqlStore) OnBucketCreation(bucket string)

func (*AbstractSqlStore) OnBucketDeletion

func (store *AbstractSqlStore) OnBucketDeletion(bucket string)

func (*AbstractSqlStore) RollbackTransaction

func (store *AbstractSqlStore) RollbackTransaction(ctx context.Context) error

func (*AbstractSqlStore) Shutdown

func (store *AbstractSqlStore) Shutdown()

func (*AbstractSqlStore) UpdateEntry

func (store *AbstractSqlStore) UpdateEntry(ctx context.Context, entry *filer.Entry) (err error)

type SqlGenerator

type SqlGenerator interface {
	GetSqlInsert(tableName string) string
	GetSqlUpdate(tableName string) string
	GetSqlFind(tableName string) string
	GetSqlDelete(tableName string) string
	GetSqlDeleteFolderChildren(tableName string) string
	GetSqlListExclusive(tableName string) string
	GetSqlListInclusive(tableName string) string
	GetSqlCreateTable(tableName string) string
	GetSqlDropTable(tableName string) string
}

type TxOrDB

type TxOrDB interface {
	ExecContext(ctx context.Context, query string, args ...interface{}) (sql.Result, error)
	QueryRowContext(ctx context.Context, query string, args ...interface{}) *sql.Row
	QueryContext(ctx context.Context, query string, args ...interface{}) (*sql.Rows, error)
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL