Documentation ¶
Index ¶
- Constants
- type MongoMapper
- func (m *MongoMapper) Delete(ctx context.Context, id string) (int64, error)
- func (m *MongoMapper) FindOne(ctx context.Context, id string) (*User, error)
- func (m *MongoMapper) FindOneByEmail(ctx context.Context, email string) (*User, error)
- func (m *MongoMapper) GetConn() *monc.Model
- func (m *MongoMapper) Insert(ctx context.Context, data *User) (string, error)
- func (m *MongoMapper) Update(ctx context.Context, data *User) (*mongo.UpdateResult, error)
- func (m *MongoMapper) UpdateByEmail(ctx context.Context, data *User, Email string) (*mongo.UpdateResult, error)
- type User
- type UserMongoMapper
Constants ¶
View Source
const CollectionName = "User"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MongoMapper ¶
type MongoMapper struct {
// contains filtered or unexported fields
}
func (*MongoMapper) FindOneByEmail ¶
func (*MongoMapper) GetConn ¶
func (m *MongoMapper) GetConn() *monc.Model
func (*MongoMapper) Update ¶
func (m *MongoMapper) Update(ctx context.Context, data *User) (*mongo.UpdateResult, error)
func (*MongoMapper) UpdateByEmail ¶
func (m *MongoMapper) UpdateByEmail(ctx context.Context, data *User, Email string) (*mongo.UpdateResult, error)
type User ¶
type User struct { ID primitive.ObjectID `bson:"_id,omitempty" json:"id,omitempty"` Name string `bson:"name,omitempty"` Email string `bson:"email,omitempty"` PassWord string `bson:"passWord,omitempty"` Sex *int32 `bson:"sex,omitempty"` FullName string `bson:"fullName,omitempty"` IdCard string `bson:"idCard,omitempty"` Memory *int64 `bson:"memory,omitempty"` Flow *int64 `bson:"flow,omitempty"` Money *int64 `bson:"money,omitempty"` Description string `bson:"description,omitempty"` Url string `bson:"url,omitempty"` UpdateAt time.Time `bson:"updateAt,omitempty" json:"updateAt,omitempty"` CreateAt time.Time `bson:"createAt,omitempty" json:"createAt,omitempty"` }
type UserMongoMapper ¶
type UserMongoMapper interface { Insert(ctx context.Context, data *User) (string, error) FindOne(ctx context.Context, id string) (*User, error) Update(ctx context.Context, data *User) (*mongo.UpdateResult, error) UpdateByEmail(ctx context.Context, data *User, Email string) (*mongo.UpdateResult, error) Delete(ctx context.Context, id string) (int64, error) FindOneByEmail(ctx context.Context, email string) (*User, error) GetConn() *monc.Model }
func NewMongoModel ¶
func NewMongoModel(config *config.Config) UserMongoMapper
Click to show internal directories.
Click to hide internal directories.