// GetByUsername extracts user by username
GetByUsername extracts user by username
// GetByUsername extracts user by username
func (d *MongoUserDao) GetByUsername(username string) (*s.User, error) {
	result := &s.User{}
	collection := d.Client.Database(d.DatabaseName).Collection(collectionName)
	err := collection.FindOne(d.Ctx, bson.M{
		"username": strings.ToLower(username),
	}).Decode(result)
	if err != nil {
		if err == mongo.ErrNoDocuments {
			return nil, nil
		}
		logger.Logf("ERROR %s", err)
		return nil, err
	}
	return result, nil
}
func ( d * MongoUserDao ) GetByUsername ( username string ) ( * s . User , error ) { result := & s . User { } collection := d . Client . Database ( d . DatabaseName ) . Collection ( collectionName ) err := collection . FindOne ( d . Ctx , bson . M { " " : strings . ToLower ( username ) , } ) . Decode ( result ) if err != nil { if err == mongo . ErrNoDocuments { return nil , nil } logger . Logf ( " " , err ) return nil , err } return result , nil }
GetByUsername extracts user by username
GetByUsername extracts user by username