Documentation ¶
Index ¶
- func Delete(ctx context.Context, collection *mongo.Collection, id primitive.ObjectID)
- func DeleteMany(ctx context.Context, collection *mongo.Collection, ids []string)
- func Install(config *ConfigEntity) (*mongo.Database, error)
- func SoftDelete(ctx context.Context, collection *mongo.Collection, id primitive.ObjectID)
- func SoftDeleteMany(ctx context.Context, collection *mongo.Collection, ids []string)
- func StrIdToObjectId(ids []string) []primitive.ObjectID
- func WithPagingFilter(page, size uint64, option *options.FindOptions)
- func WithTimerFilter(start, end string, option *bson.D)
- type ConfigEntity
- type TLSEntity
- type TableEntity
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DeleteMany ¶
func DeleteMany(ctx context.Context, collection *mongo.Collection, ids []string)
func SoftDelete ¶
func SoftDeleteMany ¶
func SoftDeleteMany(ctx context.Context, collection *mongo.Collection, ids []string)
func StrIdToObjectId ¶
func WithPagingFilter ¶ added in v0.1.0
func WithPagingFilter(page, size uint64, option *options.FindOptions)
func WithTimerFilter ¶ added in v0.1.0
Types ¶
type ConfigEntity ¶
type ConfigEntity struct { Tls TLSEntity `json:"tls" bson:"tls" yaml:"tls" mapstructure:"tls"` Account string `json:"account" bson:"account" yaml:"account" mapstructure:"account"` Password string `json:"password" bson:"password" yaml:"password" mapstructure:"password"` Address string `json:"address" yaml:"address" mapstructure:"address"` Database string `json:"database" yaml:"database" mapstructure:"database"` Mode bool `json:"mode" yaml:"mode" mapstructure:"mode"` // Mode is true cluster MaxOpenConnects int `json:"max_open_connects" bson:"max_open_connects" yaml:"max_open_connects" mapstructure:"max_open_connects"` MaxIdleConnects int `json:"max_idle_connects" bson:"max_idle_connects" yaml:"max_idle_connects" mapstructure:"max_idle_connects"` ConnMaxLifeTime int `json:"conn_max_life_time" bson:"conn_max_life_time" yaml:"conn_max_life_time" mapstructure:"conn_max_life_time"` LoggerEnable bool `json:"logger_enable" bson:"logger_enable" yaml:"logger_enable" mapstructure:"logger_enable"` // contains filtered or unexported fields }
func (*ConfigEntity) WithLoggerConsole ¶ added in v0.2.4
func (config *ConfigEntity) WithLoggerConsole(state bool)
func (*ConfigEntity) WithLoggerHandle ¶ added in v0.2.4
func (config *ConfigEntity) WithLoggerHandle(handle func(b []byte))
type TLSEntity ¶
type TLSEntity struct { CaCert string `json:"ca_cert" bson:"ca_cert" yaml:"ca_cert" mapstructure:"ca_cert"` ClientCert string `json:"client_cert" bson:"client_cert" yaml:"client_cert" mapstructure:"client_cert"` ClientCertKey string `json:"client_cert_key" bson:"client_cert_key" yaml:"client_cert_key" mapstructure:"client_cert_key"` }
type TableEntity ¶
type TableEntity struct { ID primitive.ObjectID `json:"id" bson:"_id"` CreatedAt time.Time `json:"created_at" bson:"created_at"` UpdatedAt time.Time `json:"updated_at" bson:"updated_at"` DeletedAt *time.Time `json:"deleted_at" bson:"deleted_at,omitempty"` }
func (*TableEntity) BeforeInset ¶
func (table *TableEntity) BeforeInset()
func (*TableEntity) BeforeUpdate ¶
func (table *TableEntity) BeforeUpdate()
Click to show internal directories.
Click to hide internal directories.