Documentation
¶
Index ¶
- func NewEvaluationRepository(ctx context.Context, db *mongo.Database) (repository.Evaluation, error)
- func NewFlagRepository(ctx context.Context, db *mongo.Database) (repository.Flag, error)
- func NewRuleRepository(flagRepo *FlagRepository, segmentRepo *SegmentRepository) repository.Rule
- func NewSegmentRepository(ctx context.Context, db *mongo.Database) (repository.Segment, error)
- func NewUserRepository(ctx context.Context, db *mongo.Database) (repository.User, error)
- func NewVariantRepository(flagRepo *FlagRepository) repository.Variant
- type EvaluationRepository
- func (r *EvaluationRepository) DeleteAllByUserID(ctx context.Context, userID string) error
- func (r *EvaluationRepository) DeleteByID(ctx context.Context, idHex string) error
- func (r *EvaluationRepository) FindAllByReqHash(ctx context.Context, reqHash string) (flaggio.EvaluationList, error)
- func (r *EvaluationRepository) FindAllByUserID(ctx context.Context, userID string, search *string, offset, limit *int64) (*flaggio.EvaluationResults, error)
- func (r *EvaluationRepository) FindByID(ctx context.Context, idHex string) (*flaggio.Evaluation, error)
- func (r *EvaluationRepository) FindByReqHashAndFlagKey(ctx context.Context, reqHash, flagKey string) (*flaggio.Evaluation, error)
- func (r *EvaluationRepository) ReplaceAll(ctx context.Context, userID, reqHash string, evals flaggio.EvaluationList) error
- func (r *EvaluationRepository) ReplaceOne(ctx context.Context, userID string, eval *flaggio.Evaluation) error
- type FlagRepository
- func (r *FlagRepository) Create(ctx context.Context, f flaggio.NewFlag) (string, error)
- func (r *FlagRepository) Delete(ctx context.Context, idHex string) error
- func (r *FlagRepository) FindAll(ctx context.Context, search *string, offset, limit *int64) (*flaggio.FlagResults, error)
- func (r *FlagRepository) FindByID(ctx context.Context, idHex string) (*flaggio.Flag, error)
- func (r *FlagRepository) FindByKey(ctx context.Context, key string) (*flaggio.Flag, error)
- func (r *FlagRepository) Update(ctx context.Context, idHex string, f flaggio.UpdateFlag) error
- type RuleRepository
- func (r *RuleRepository) CreateFlagRule(ctx context.Context, flagIDHex string, fr flaggio.NewFlagRule) (string, error)
- func (r *RuleRepository) CreateSegmentRule(ctx context.Context, segmentIDHex string, fr flaggio.NewSegmentRule) (string, error)
- func (r *RuleRepository) DeleteFlagRule(ctx context.Context, flagIDHex, idHex string) error
- func (r *RuleRepository) DeleteSegmentRule(ctx context.Context, segmentIDHex, idHex string) error
- func (r *RuleRepository) FindFlagRuleByID(ctx context.Context, flagIDHex, idHex string) (*flaggio.FlagRule, error)
- func (r *RuleRepository) FindSegmentRuleByID(ctx context.Context, segmentIDHex, idHex string) (*flaggio.SegmentRule, error)
- func (r *RuleRepository) UpdateFlagRule(ctx context.Context, flagIDHex, idHex string, fr flaggio.UpdateFlagRule) error
- func (r *RuleRepository) UpdateSegmentRule(ctx context.Context, segmentIDHex, idHex string, fr flaggio.UpdateSegmentRule) error
- type SegmentRepository
- func (r *SegmentRepository) Create(ctx context.Context, f flaggio.NewSegment) (string, error)
- func (r *SegmentRepository) Delete(ctx context.Context, idHex string) error
- func (r *SegmentRepository) FindAll(ctx context.Context, offset, limit *int64) ([]*flaggio.Segment, error)
- func (r *SegmentRepository) FindByID(ctx context.Context, idHex string) (*flaggio.Segment, error)
- func (r *SegmentRepository) Update(ctx context.Context, idHex string, f flaggio.UpdateSegment) error
- type UserRepository
- func (r *UserRepository) Delete(ctx context.Context, userID string) error
- func (r *UserRepository) FindAll(ctx context.Context, search *string, offset, limit *int64) (*flaggio.UserResults, error)
- func (r *UserRepository) FindByID(ctx context.Context, id string) (*flaggio.User, error)
- func (r *UserRepository) Replace(ctx context.Context, userID string, userCtx flaggio.UserContext) error
- type VariantRepository
- func (r *VariantRepository) Create(ctx context.Context, flagIDHex string, v flaggio.NewVariant) (string, error)
- func (r *VariantRepository) Delete(ctx context.Context, flagIDHex, idHex string) error
- func (r *VariantRepository) FindByID(ctx context.Context, flagIDHex, idHex string) (*flaggio.Variant, error)
- func (r *VariantRepository) Update(ctx context.Context, flagIDHex, idHex string, v flaggio.UpdateVariant) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewEvaluationRepository ¶
func NewEvaluationRepository(ctx context.Context, db *mongo.Database) (repository.Evaluation, error)
NewEvaluationRepository returns a new evaluation repository that uses mongodb as underlying storage. It also creates all needed indexes, if they don't yet exist.
func NewFlagRepository ¶
NewFlagRepository returns a new flag repository that uses mongodb as underlying storage. It also creates all needed indexes, if they don't yet exist.
func NewRuleRepository ¶
func NewRuleRepository(flagRepo *FlagRepository, segmentRepo *SegmentRepository) repository.Rule
NewRuleRepository returns a new rule repository that uses mongodb as underlying storage.
func NewSegmentRepository ¶
NewSegmentRepository returns a new segment repository that uses mongodb as underlying storage. It also creates all needed indexes, if they don't yet exist.
func NewUserRepository ¶
NewUserRepository returns a new user repository that uses mongodb as underlying storage. It also creates all needed indexes, if they don't yet exist.
func NewVariantRepository ¶
func NewVariantRepository(flagRepo *FlagRepository) repository.Variant
NewVariantRepository returns a new variant repository that uses mongodb as underlying storage.
Types ¶
type EvaluationRepository ¶
type EvaluationRepository struct {
// contains filtered or unexported fields
}
EvaluationRepository implements repository.Flag interface using mongodb.
func (*EvaluationRepository) DeleteAllByUserID ¶
func (r *EvaluationRepository) DeleteAllByUserID(ctx context.Context, userID string) error
Delete deletes evaluations for a user.
func (*EvaluationRepository) DeleteByID ¶
func (r *EvaluationRepository) DeleteByID(ctx context.Context, idHex string) error
DeleteByID deletes an evaluation by its ID.
func (*EvaluationRepository) FindAllByReqHash ¶
func (r *EvaluationRepository) FindAllByReqHash(ctx context.Context, reqHash string) (flaggio.EvaluationList, error)
FindAllByReqHash returns all previous flag evaluations for a given request hash.
func (*EvaluationRepository) FindAllByUserID ¶
func (r *EvaluationRepository) FindAllByUserID(ctx context.Context, userID string, search *string, offset, limit *int64) (*flaggio.EvaluationResults, error)
FindAllByUserID returns all previous flag evaluations for a given user ID.
func (*EvaluationRepository) FindByID ¶
func (r *EvaluationRepository) FindByID(ctx context.Context, idHex string) (*flaggio.Evaluation, error)
FindByID returns a previous flag evaluation by its ID.
func (*EvaluationRepository) FindByReqHashAndFlagKey ¶
func (r *EvaluationRepository) FindByReqHashAndFlagKey(ctx context.Context, reqHash, flagKey string) (*flaggio.Evaluation, error)
FindByReqHashAndFlagKey returns a previous flag evaluation for a given request hash and flag key.
func (*EvaluationRepository) ReplaceAll ¶
func (r *EvaluationRepository) ReplaceAll(ctx context.Context, userID, reqHash string, evals flaggio.EvaluationList) error
ReplaceAll creates or replaces evaluations for a combination of user and request hash.
func (*EvaluationRepository) ReplaceOne ¶
func (r *EvaluationRepository) ReplaceOne(ctx context.Context, userID string, eval *flaggio.Evaluation) error
ReplaceOne creates or replaces one evaluation for a user ID.
type FlagRepository ¶
type FlagRepository struct {
// contains filtered or unexported fields
}
FlagRepository implements repository.Flag interface using mongodb.
func (*FlagRepository) Delete ¶
func (r *FlagRepository) Delete(ctx context.Context, idHex string) error
Delete deletes a flag.
func (*FlagRepository) FindAll ¶
func (r *FlagRepository) FindAll(ctx context.Context, search *string, offset, limit *int64) (*flaggio.FlagResults, error)
FindAll returns a list of flags, based on an optional offset and limit.
func (*FlagRepository) Update ¶
func (r *FlagRepository) Update(ctx context.Context, idHex string, f flaggio.UpdateFlag) error
Update updates a flag.
type RuleRepository ¶
type RuleRepository struct {
// contains filtered or unexported fields
}
RuleRepository implements repository.Rule interface using mongodb.
func (*RuleRepository) CreateFlagRule ¶
func (r *RuleRepository) CreateFlagRule(ctx context.Context, flagIDHex string, fr flaggio.NewFlagRule) (string, error)
CreateFlagRule creates a new rule under a flag.
func (*RuleRepository) CreateSegmentRule ¶
func (r *RuleRepository) CreateSegmentRule(ctx context.Context, segmentIDHex string, fr flaggio.NewSegmentRule) (string, error)
CreateSegmentRule creates a new rule under a segment.
func (*RuleRepository) DeleteFlagRule ¶
func (r *RuleRepository) DeleteFlagRule(ctx context.Context, flagIDHex, idHex string) error
DeleteFlagRule deletes a rule under a flag.
func (*RuleRepository) DeleteSegmentRule ¶
func (r *RuleRepository) DeleteSegmentRule(ctx context.Context, segmentIDHex, idHex string) error
DeleteSegmentRule deletes a rule under a segment.
func (*RuleRepository) FindFlagRuleByID ¶
func (r *RuleRepository) FindFlagRuleByID(ctx context.Context, flagIDHex, idHex string) (*flaggio.FlagRule, error)
FindFlagRuleByID returns a flag rule that has a given ID.
func (*RuleRepository) FindSegmentRuleByID ¶
func (r *RuleRepository) FindSegmentRuleByID(ctx context.Context, segmentIDHex, idHex string) (*flaggio.SegmentRule, error)
FindSegmentRuleByID returns a segment rule that has a given ID.
func (*RuleRepository) UpdateFlagRule ¶
func (r *RuleRepository) UpdateFlagRule(ctx context.Context, flagIDHex, idHex string, fr flaggio.UpdateFlagRule) error
UpdateFlagRule updates a rule under a flag.
func (*RuleRepository) UpdateSegmentRule ¶
func (r *RuleRepository) UpdateSegmentRule(ctx context.Context, segmentIDHex, idHex string, fr flaggio.UpdateSegmentRule) error
UpdateSegmentRule updates a rule under a segment.
type SegmentRepository ¶
type SegmentRepository struct {
// contains filtered or unexported fields
}
SegmentRepository implements repository.Segment interface using mongodb.
func (*SegmentRepository) Create ¶
func (r *SegmentRepository) Create(ctx context.Context, f flaggio.NewSegment) (string, error)
Create creates a new segment.
func (*SegmentRepository) Delete ¶
func (r *SegmentRepository) Delete(ctx context.Context, idHex string) error
Delete deletes a segment.
func (*SegmentRepository) FindAll ¶
func (r *SegmentRepository) FindAll(ctx context.Context, offset, limit *int64) ([]*flaggio.Segment, error)
FindAll returns a list of segments, based on an optional offset and limit.
func (*SegmentRepository) Update ¶
func (r *SegmentRepository) Update(ctx context.Context, idHex string, f flaggio.UpdateSegment) error
Update updates a segment.
type UserRepository ¶
type UserRepository struct {
// contains filtered or unexported fields
}
UserRepository implements repository.Flag interface using mongodb.
func (*UserRepository) Delete ¶
func (r *UserRepository) Delete(ctx context.Context, userID string) error
Delete deletes a user.
func (*UserRepository) FindAll ¶
func (r *UserRepository) FindAll(ctx context.Context, search *string, offset, limit *int64) (*flaggio.UserResults, error)
FindAll returns a list of users, based on an optional offset and limit.
func (*UserRepository) Replace ¶
func (r *UserRepository) Replace(ctx context.Context, userID string, userCtx flaggio.UserContext) error
Replace creates or updates a user.
type VariantRepository ¶
type VariantRepository struct {
// contains filtered or unexported fields
}
VariantRepository implements repository.Variant interface using mongodb.
func (*VariantRepository) Create ¶
func (r *VariantRepository) Create(ctx context.Context, flagIDHex string, v flaggio.NewVariant) (string, error)
Create creates a new variant under a flag.
func (*VariantRepository) Delete ¶
func (r *VariantRepository) Delete(ctx context.Context, flagIDHex, idHex string) error
Delete deletes a variant under a flag.
func (*VariantRepository) FindByID ¶
func (r *VariantRepository) FindByID(ctx context.Context, flagIDHex, idHex string) (*flaggio.Variant, error)
FindByID returns a variant that has a given ID.
func (*VariantRepository) Update ¶
func (r *VariantRepository) Update(ctx context.Context, flagIDHex, idHex string, v flaggio.UpdateVariant) error
Update updates a variant under a flag.