Documentation ¶
Index ¶
- Variables
- func BaseGroup[T dependency.IEntity](f func(v ...*T) (int64, error), opt *dependency.BaseOption, p ...*T) (int64, error)
- func CheckLink(ctx context.Context, name, uri string) error
- func CoreByCtx(ctx context.Context) *options.ClientOptions
- func CoreById(id string) *options.ClientOptions
- func GetDbTX(id string) contextex.ContextKey
- func GetMongoNameByCtx(ctx context.Context) string
- func GetMongoNameByKey(key string) string
- func GetNamedMongoClient(key string) *options.ClientOptions
- func Invoke(ctx context.Context, opts *options.ClientOptions, ...) error
- func Log(ctx context.Context, msg string, lvl zapcore.Level)
- func NewLoggerOptions() *options.LoggerOptions
- func NewMongo(key, dbname, conn string)
- func Option2Page(opt *dependency.BaseOption) *options.FindOptions
- func QueryConds(opt *dependency.BaseOption) bson.D
- func QueryFields(opt *dependency.BaseOption) bson.D
- func SetGetKeyFunc(f func(ctx context.Context) string)
- type BaseRepository
- func (r *BaseRepository[T]) BaseCount(ctx context.Context, opts ...dependency.BaseOptionFunc) (int64, error)
- func (r *BaseRepository[T]) BaseCreate(ctx context.Context, ps []*T, opts ...dependency.BaseOptionFunc) (int64, error)
- func (r *BaseRepository[T]) BaseDelete(ctx context.Context, p *T, opts ...dependency.BaseOptionFunc) (int64, error)
- func (r *BaseRepository[T]) BaseGet(ctx context.Context, opts ...dependency.BaseOptionFunc) (*T, error)
- func (r *BaseRepository[T]) BaseQuery(ctx context.Context, opts ...dependency.BaseOptionFunc) ([]T, error)
- func (r *BaseRepository[T]) BaseQueryWithCount(ctx context.Context, opts ...dependency.BaseOptionFunc) ([]T, int64, error)
- func (r *BaseRepository[T]) BaseSave(ctx context.Context, ps []*T, opts ...dependency.BaseOptionFunc) (int64, error)
- func (r *BaseRepository[T]) BaseUpdate(ctx context.Context, p *T, opts ...dependency.BaseOptionFunc) (int64, error)
- func (r *BaseRepository[T]) BuildConds(ctx context.Context, t *T, opt *dependency.BaseOption, ...) error
- func (r *BaseRepository[T]) BuildFrmOption(ctx context.Context, t *T, opt *dependency.BaseOption, ...) error
- func (r *BaseRepository[T]) BuildFrmOptions(ctx context.Context, t *T, colcallback func(*mongo.Collection) error, ...) error
- type Logger
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrCurNil = errors.New("cur is nil") MongoComponent = embedded.NewComponent[*options.ClientOptions]() MongoNameMap = map[string]string{} )
Functions ¶
func BaseGroup ¶
func BaseGroup[T dependency.IEntity](f func(v ...*T) (int64, error), opt *dependency.BaseOption, p ...*T) (int64, error)
BaseGroup
func CoreById ¶
func CoreById(id string) *options.ClientOptions
func GetDbTX ¶
func GetDbTX(id string) contextex.ContextKey
func GetMongoNameByCtx ¶
func GetMongoNameByKey ¶
func GetNamedMongoClient ¶
func GetNamedMongoClient(key string) *options.ClientOptions
GetNamedMongoClient from mongo map
func NewLoggerOptions ¶
func NewLoggerOptions() *options.LoggerOptions
func QueryConds ¶
func QueryConds(opt *dependency.BaseOption) bson.D
func QueryFields ¶
func QueryFields(opt *dependency.BaseOption) bson.D
func SetGetKeyFunc ¶
Types ¶
type BaseRepository ¶
type BaseRepository[T dependency.IEntity] struct{} // base repository
func (*BaseRepository[T]) BaseCount ¶
func (r *BaseRepository[T]) BaseCount(ctx context.Context, opts ...dependency.BaseOptionFunc) (int64, error)
BaseCount
func (*BaseRepository[T]) BaseCreate ¶
func (r *BaseRepository[T]) BaseCreate(ctx context.Context, ps []*T, opts ...dependency.BaseOptionFunc) (int64, error)
BaseCreate
func (*BaseRepository[T]) BaseDelete ¶
func (r *BaseRepository[T]) BaseDelete(ctx context.Context, p *T, opts ...dependency.BaseOptionFunc) (int64, error)
BaseDelete
func (*BaseRepository[T]) BaseGet ¶
func (r *BaseRepository[T]) BaseGet(ctx context.Context, opts ...dependency.BaseOptionFunc) (*T, error)
BaseGet
func (*BaseRepository[T]) BaseQuery ¶
func (r *BaseRepository[T]) BaseQuery(ctx context.Context, opts ...dependency.BaseOptionFunc) ([]T, error)
BaseQuery
func (*BaseRepository[T]) BaseQueryWithCount ¶
func (r *BaseRepository[T]) BaseQueryWithCount(ctx context.Context, opts ...dependency.BaseOptionFunc) ([]T, int64, error)
BaseQueryWithCount
func (*BaseRepository[T]) BaseSave ¶
func (r *BaseRepository[T]) BaseSave(ctx context.Context, ps []*T, opts ...dependency.BaseOptionFunc) (int64, error)
BaseSave
func (*BaseRepository[T]) BaseUpdate ¶
func (r *BaseRepository[T]) BaseUpdate(ctx context.Context, p *T, opts ...dependency.BaseOptionFunc) (int64, error)
BaseUpdate
func (*BaseRepository[T]) BuildConds ¶
func (r *BaseRepository[T]) BuildConds(ctx context.Context, t *T, opt *dependency.BaseOption, dbcallback func(*mongo.Database) error) error
BuildConds
func (*BaseRepository[T]) BuildFrmOption ¶
func (r *BaseRepository[T]) BuildFrmOption(ctx context.Context, t *T, opt *dependency.BaseOption, colcallback func(*mongo.Collection) error) error
BuildFrmOption
func (*BaseRepository[T]) BuildFrmOptions ¶
func (r *BaseRepository[T]) BuildFrmOptions(ctx context.Context, t *T, colcallback func(*mongo.Collection) error, opts ...dependency.BaseOptionFunc) error
BuildFrmOptions
Click to show internal directories.
Click to hide internal directories.