mrstorage

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2023 License: Apache-2.0 Imports: 4 Imported by: 21

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DBConn added in v0.6.0

type DBConn interface {
	Begin(ctx context.Context) (DBTransaction, error)
	DBQuery
}

type DBQuery added in v0.6.0

type DBQuery interface {
	Query(ctx context.Context, sql string, args ...any) (DBQueryRows, error)
	QueryRow(ctx context.Context, sql string, args ...any) DBQueryRow
	Exec(ctx context.Context, sql string, args ...any) error
}

type DBQueryRow added in v0.6.0

type DBQueryRow interface {
	Scan(dest ...any) error
}

type DBQueryRows added in v0.6.0

type DBQueryRows interface {
	Next() bool
	Scan(dest ...any) error
	Err() error
	Close()
}

type DBTransaction added in v0.6.0

type DBTransaction interface {
	Commit(ctx context.Context) error
	Rollback(ctx context.Context) error
	DBQuery
}

type FileProviderAPI added in v0.6.0

type FileProviderAPI interface {
	Info(ctx context.Context, path string) (mrtype.FileInfo, error)
	Download(ctx context.Context, path string) (*mrtype.File, error)
	// Downloads(ctx context.Context, path string) (*mrtype.DownloadedFile, error) // ListObjects :TODO: получение списка объектов
	Upload(ctx context.Context, file *mrtype.File) error
	Remove(ctx context.Context, path string) error
}

type SqlBuilderOrderBy added in v0.5.0

type SqlBuilderOrderBy interface {
	WrapWithDefault(field SqlBuilderPartFunc) SqlBuilderPartFunc
	Join(fields ...SqlBuilderPartFunc) SqlBuilderPartFunc
	Field(name string, direction mrenum.SortDirection) SqlBuilderPartFunc
}

type SqlBuilderPager added in v0.5.0

type SqlBuilderPager interface {
	OffsetLimit(index, size uint64) SqlBuilderPartFunc
}

type SqlBuilderPart added in v0.5.0

type SqlBuilderPart interface {
	Empty() bool
	Param(number int) SqlBuilderPart
	WithPrefix(value string) SqlBuilderPart
	ToSql() (string, []any)
	fmt.Stringer
}

type SqlBuilderPartFunc added in v0.5.0

type SqlBuilderPartFunc func(paramNumber int) (string, []any)

func SqlBuilderPartFuncRemoveNil added in v0.5.0

func SqlBuilderPartFuncRemoveNil(parts []SqlBuilderPartFunc) []SqlBuilderPartFunc

type SqlBuilderSelect added in v0.5.0

type SqlBuilderSelect interface {
	Where(f func(w SqlBuilderWhere) SqlBuilderPartFunc) SqlBuilderPart
	OrderBy(f func(o SqlBuilderOrderBy) SqlBuilderPartFunc) SqlBuilderPart
	Pager(f func(p SqlBuilderPager) SqlBuilderPartFunc) SqlBuilderPart
}

type SqlBuilderSet added in v0.5.0

type SqlBuilderSet interface {
	Join(fields ...SqlBuilderPartFunc) SqlBuilderPartFunc
	Field(name string, value any) SqlBuilderPartFunc
	Fields(names []string, args []any) SqlBuilderPartFunc
}

type SqlBuilderUpdate added in v0.5.0

type SqlBuilderUpdate interface {
	Set(f func(s SqlBuilderSet) SqlBuilderPartFunc) SqlBuilderPart
	SetFromEntity(entity any) (SqlBuilderPart, error)
	SetFromEntityWith(entity any, extFields func(s SqlBuilderSet) SqlBuilderPartFunc) (SqlBuilderPart, error)
}

type SqlBuilderWhere added in v0.5.0

type SqlBuilderWhere interface {
	JoinAnd(conds ...SqlBuilderPartFunc) SqlBuilderPartFunc
	JoinOr(conds ...SqlBuilderPartFunc) SqlBuilderPartFunc
	Expr(expr string) SqlBuilderPartFunc
	ExprWithValue(expr string, value any) SqlBuilderPartFunc
	Equal(name string, value any) SqlBuilderPartFunc
	NotEqual(name string, value any) SqlBuilderPartFunc
	FilterEqualString(name, value string) SqlBuilderPartFunc
	FilterEqualInt64(name string, value, empty int64) SqlBuilderPartFunc
	FilterEqualBool(name string, value mrtype.NullableBool) SqlBuilderPartFunc
	FilterLike(name, value string) SqlBuilderPartFunc
	FilterLikeFields(names []string, value string) SqlBuilderPartFunc
	FilterRangeInt64(name string, value mrtype.RangeInt64, empty int64) SqlBuilderPartFunc
	FilterAnyOf(name string, values any) SqlBuilderPartFunc
}

type SqlSelectParams added in v0.5.0

type SqlSelectParams struct {
	Where   SqlBuilderPart
	OrderBy SqlBuilderPart
	Pager   SqlBuilderPart
}

Jump to

Keyboard shortcuts

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