Documentation ¶
Index ¶
- Constants
- Variables
- type Auth
- type IUserMongoMapper
- type MongoMapper
- func (m *MongoMapper) AppendAuth(ctx context.Context, id string, auth *Auth) error
- 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) FindOneByAuth(ctx context.Context, auth *Auth) (*User, error)
- 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) UpdateById(ctx context.Context, auth *Auth, id string) (*mongo.UpdateResult, error)
- type User
Constants ¶
View Source
const CollectionName = "user"
Variables ¶
View Source
var PrefixUserCacheKey = "cache:user:"
Functions ¶
This section is empty.
Types ¶
type IUserMongoMapper ¶
type IUserMongoMapper 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) // 修改 UpdateById(ctx context.Context, auth *Auth, id string) (*mongo.UpdateResult, error) // 通过id修改授权信息 Delete(ctx context.Context, id string) (int64, error) // 删除 FindOneByAuth(ctx context.Context, auth *Auth) (*User, error) // 查找某个授权信息 AppendAuth(ctx context.Context, id string, auth *Auth) error // 追加授权信息 }
func NewMongoMapper ¶
func NewMongoMapper(config *config.Config) IUserMongoMapper
type MongoMapper ¶
type MongoMapper struct {
// contains filtered or unexported fields
}
func (*MongoMapper) AppendAuth ¶
func (*MongoMapper) FindOneByAuth ¶
func (*MongoMapper) Update ¶
func (m *MongoMapper) Update(ctx context.Context, data *User) (*mongo.UpdateResult, error)
func (*MongoMapper) UpdateById ¶
func (m *MongoMapper) UpdateById(ctx context.Context, auth *Auth, id string) (*mongo.UpdateResult, error)
type User ¶
type User struct { ID primitive.ObjectID `bson:"_id,omitempty" json:"id,omitempty"` PassWord string `bson:"passWord,omitempty" json:"passWord,omitempty"` Role int32 `bson:"role,omitempty" json:"role,omitempty"` Auths []*Auth `bson:"auths,omitempty" json:"auths,omitempty"` UpdateAt time.Time `bson:"updateAt,omitempty" json:"updateAt,omitempty"` CreateAt time.Time `bson:"createAt,omitempty" json:"createAt,omitempty"` }
Click to show internal directories.
Click to hide internal directories.