Documentation ¶
Index ¶
- Variables
- func Decode(src string) string
- func Encode(src string) string
- func EnsureAllIndex(fns ...IndexOptionsHandler) error
- func GetIDFromSingleResult(single *mongo.SingleResult) (string, error)
- func GetPostHooks(name string, className string) (func(), bool)
- func I32Time(c int32) string
- func I64Date(c int64) string
- func I64DateTime(c int64) string
- func I64Time(c int64) string
- func IndexKey(i any) string
- func IsErrNotFound(err error) bool
- func MsSQLOffsetLimit(offset, limit int) string
- func MsSQLTimeFormat(t interface{}) string
- func MsSQLTimeParse(s string) time.Time
- func NewStringSlice(len int, val string) []string
- func PrintToJson(obj interface{})
- func RegisterEzOrmObj(namespace, classname string, constructor func() EzOrmObj)
- func RegisterEzOrmObjByID(namespace, classname string, f func(id string) (result EzOrmObj, err error))
- func RegisterEzOrmObjRemove(namespace, classname string, f func(id string) (err error))
- func RegisterIndexer(namespace, classname string, indexer func())
- func RegisterSetupPostHooks(name string, className string, fn func())
- func RemoveEzOrmObj(namespace, classname, id string) (err error)
- func SQLOffsetLimit(offset, limit int) string
- func SQLOrderBy(field string, revert bool) string
- func SQLWhere(conditions []string) string
- func SetupIndexModel(c *mongo.Collection, keys []mongo.IndexModel)
- func SliceJoin(objs []interface{}, sep string) string
- func StringScan(str string, v interface{}) error
- func TimeFormat(t time.Time) string
- func TimeParse(s string) time.Time
- func TimeParseLocalTime(s string) time.Time
- func TimeToLocalTime(c time.Time) string
- func ToFloat64(value interface{}) (float64, error)
- func ToJsonString(obj interface{}) string
- func ToResult[T Result](rawField any) (T, error)
- func Transact(db *DBStore, t Transactor) error
- func TransactFunc(db *DBStore, txFunc func(*DBTx) error) (err error)
- func UniqURLParams(url_ string) string
- func XGetMoreSearchObj(word string, fields []string, params map[string]interface{}, ...) map[string]interface{}
- func XGetQuery(key string, data map[string]interface{}) map[string]interface{}
- func XGetQueryString(word string, fields []string) map[string]interface{}
- func XGetSearchObj(word string, fields []string, params map[string]string, ...) map[string]interface{}
- func XSortFieldsFilter(sortFields []string) (rtn []string)
- type DB
- type DBStore
- func (store *DBStore) AddWrappers(wp ...database.Wrapper)
- func (store *DBStore) BeginTx() (*DBTx, error)
- func (store *DBStore) Close() error
- func (store *DBStore) Debug(b bool)
- func (store *DBStore) Exec(ctx context.Context, query string, args ...interface{}) (sql.Result, error)
- func (store *DBStore) Query(ctx context.Context, query string, args ...interface{}) (*sql.Rows, error)
- func (store *DBStore) SetError(err error)
- func (store *DBStore) SlowLog(duration time.Duration)
- type DBTx
- type EzOrmObj
- type FieldIN
- type FieldMultiIN
- type IndexModifier
- type IndexOptionsHandler
- type IndexResult
- type Result
- type SearchObj
- type Transactor
Constants ¶
This section is empty.
Variables ¶
View Source
var ( DateTimeLayout = "2006-01-02 15:04" DateLayout = "2006-01-02" TimeLayout = "15:04" )
View Source
var ErrScanResultTypeUnsupported = fmt.Errorf("scan result type unsupported")
View Source
var (
Indexers = make(map[string]func())
)
Functions ¶
func EnsureAllIndex ¶
func EnsureAllIndex(fns ...IndexOptionsHandler) error
func GetIDFromSingleResult ¶ added in v0.0.13
func GetIDFromSingleResult(single *mongo.SingleResult) (string, error)
func GetPostHooks ¶ added in v0.0.5
func I64DateTime ¶
func MsSQLOffsetLimit ¶
func MsSQLTimeFormat ¶
func MsSQLTimeFormat(t interface{}) string
func MsSQLTimeParse ¶
func NewStringSlice ¶
func PrintToJson ¶
func PrintToJson(obj interface{})
func RegisterEzOrmObj ¶
func RegisterEzOrmObjByID ¶
func RegisterEzOrmObjRemove ¶
func RegisterIndexer ¶
func RegisterIndexer(namespace, classname string, indexer func())
func RegisterSetupPostHooks ¶
func RemoveEzOrmObj ¶
func SQLOffsetLimit ¶
func SQLOrderBy ¶
func SetupIndexModel ¶
func SetupIndexModel(c *mongo.Collection, keys []mongo.IndexModel)
func StringScan ¶
func TimeFormat ¶
func TimeParseLocalTime ¶
func TimeToLocalTime ¶
func ToJsonString ¶
func ToJsonString(obj interface{}) string
func ToResult ¶ added in v0.0.8
Inspired by https://github.com/go-sql-driver/mysql/issues/86, if the Go SQL driver cannot determine the underlying type of scan result(`interface{}` or `any`), it will fallback to TEXT protocol to communicate with MySQL server, therefore, the result can only be `[]uint8`(`[]byte`) or raw `string`. But the behavior differs from drivers.
func Transact ¶
func Transact(db *DBStore, t Transactor) error
func UniqURLParams ¶
func XGetMoreSearchObj ¶
func XGetQueryString ¶
func XGetSearchObj ¶
func XSortFieldsFilter ¶
Types ¶
type DBStore ¶
func NewDBDSNStore ¶
func NewDBStore ¶
func NewDBStoreCharset ¶
func NewDBStoreWithRawDB ¶
func (*DBStore) AddWrappers ¶
type DBTx ¶
type DBTx struct {
// contains filtered or unexported fields
}
func (*DBTx) IsRollback ¶
type FieldIN ¶
type FieldIN struct { Field string Params []interface{} // contains filtered or unexported fields }
func NewFieldIN ¶
type FieldMultiIN ¶
type FieldMultiIN struct {
// contains filtered or unexported fields
}
func NewMultiFieldIN ¶
func NewMultiFieldIN(fields []string) *FieldMultiIN
func (*FieldMultiIN) Add ¶
func (in *FieldMultiIN) Add(v []interface{}) error
func (*FieldMultiIN) SQLFormat ¶
func (in *FieldMultiIN) SQLFormat() string
func (*FieldMultiIN) SQLParams ¶
func (in *FieldMultiIN) SQLParams() []interface{}
type IndexModifier ¶
type IndexModifier struct { Key bson.D Option *options.IndexOptions Result IndexResult }
type IndexOptionsHandler ¶
type IndexOptionsHandler func(im *IndexModifier) error
func IndexCreateResult ¶ added in v0.0.6
func IndexCreateResult(exist *int, created *int) IndexOptionsHandler
func WithIndexNameHandler ¶
func WithIndexNameHandler(index bson.D, opt *options.IndexOptions) IndexOptionsHandler
type IndexResult ¶ added in v0.0.6
type Transactor ¶
Click to show internal directories.
Click to hide internal directories.