db

package
v0.0.0-...-12a6c45 Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Delete

func Delete(obj interface{}) error

func DeleteMany

func DeleteMany(table interface{}, filter interface{}) error

func Find

func Find(out interface{}, filter interface{}, options ...FindOption) error

func FindById

func FindById(out interface{}, id string) error

func FindOne

func FindOne(out interface{}, filter interface{}, options ...FindOption) error

func GetIDValue

func GetIDValue(obj interface{}) string

func GetTableName

func GetTableName(obj interface{}) string

func RegConnCreator

func RegConnCreator(typeName string, creator ConnectionCreator)

func Save

func Save(obj interface{}) error

func ToSnakeCase

func ToSnakeCase(str string) string

func UpdateMany

func UpdateMany(table interface{}, filter interface{}, update interface{}) error

Types

type BeforeInsertHandler

type BeforeInsertHandler interface {
	BeforeCreate()
}

type Connection

type Connection interface {
	Save(obj interface{}) error
	Update(table interface{}, filter interface{}, update interface{}) error
	Delete(obj interface{}) error
	DeleteMany(table interface{}, filter interface{}) error
	FindById(out interface{}, id string) error
	FindOne(out interface{}, filter interface{}, options ...FindOption) error
	Find(out interface{}, filter interface{}, options ...FindOption) error
}

func Conn

func Conn(name ...string) Connection

type ConnectionCreator

type ConnectionCreator func(configName string) (Connection, error)

type FieldOrder

type FieldOrder struct {
	Field string
	Order string
}

func Asc

func Asc(fieldName string) FieldOrder

func Desc

func Desc(fieldName string) FieldOrder

type FindOption

type FindOption struct {
	Skip  int
	Limit int
	Order []FieldOrder
}

type MongoConn

type MongoConn struct {
	// contains filtered or unexported fields
}

func (*MongoConn) Delete

func (o *MongoConn) Delete(obj interface{}) error

func (*MongoConn) DeleteMany

func (o *MongoConn) DeleteMany(table interface{}, filter interface{}) error

func (*MongoConn) Find

func (o *MongoConn) Find(out interface{}, filter interface{}, findOptions ...FindOption) error

func (*MongoConn) FindById

func (o *MongoConn) FindById(out interface{}, id string) error

func (*MongoConn) FindOne

func (o *MongoConn) FindOne(out interface{}, filter interface{}, opt ...FindOption) error

func (*MongoConn) Save

func (o *MongoConn) Save(obj interface{}) error

func (*MongoConn) Update

func (o *MongoConn) Update(table interface{}, filter interface{}, update interface{}) error

type TableNameInformer

type TableNameInformer interface {
	TableName() string
}

Jump to

Keyboard shortcuts

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