ffuser

package
v1.25.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 5, 2024 License: MIT Imports: 0 Imported by: 7

Documentation

Overview

Package ffuser defines the go-feature-flag model for user properties.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type User deprecated

type User struct {
	// contains filtered or unexported fields
}

Deprecated: User, please use ffcontext.EvaluationContext instead.

A User contains specific attributes of a user browsing your site. The only mandatory property is the Key, which must uniquely identify each user. For authenticated users, this may be a username or e-mail address. For anonymous users, this could be an IP address or session ID.

User fields are immutable and can be accessed only via getter methods. To construct a User, use either a simple constructor (NewUser, NewAnonymousUser) or the builder pattern with NewUserBuilder.

func NewAnonymousUser deprecated

func NewAnonymousUser(key string) User

Deprecated: NewAnonymousUser, please use ffcontext.NewAnonymousEvaluationContext instead.

NewAnonymousUser creates a new anonymous user identified by the given key.

func NewUser deprecated

func NewUser(key string) User

Deprecated: NewUser, please use ffcontext.NewEvaluationContext instead

NewUser creates a new user identified by the given key.

func (User) AddCustomAttribute added in v1.8.0

func (u User) AddCustomAttribute(name string, value interface{})

AddCustomAttribute allows to add a custom attribute into the user.

func (User) GetCustom

func (u User) GetCustom() map[string]interface{}

GetCustom return all the custom properties of a user.

func (User) GetKey

func (u User) GetKey() string

GetKey return the unique key for the user.

func (User) IsAnonymous

func (u User) IsAnonymous() bool

IsAnonymous return if the user is anonymous or not.

type UserBuilder deprecated

type UserBuilder interface {
	Anonymous(bool) UserBuilder
	AddCustom(string, interface{}) UserBuilder
	Build() User
}

Deprecated: UserBuilder, please use ffcontext.EvaluationContextBuilder instead.

UserBuilder is a builder to create a User.

func NewUserBuilder deprecated

func NewUserBuilder(key string) UserBuilder

Deprecated: NewUserBuilder, please use ffcontext.NewEvaluationContextBuilder instead.

NewUserBuilder constructs a new UserBuilder, specifying the user key.

For authenticated users, the key may be a username or e-mail address. For anonymous users, this could be an IP address or session ID.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL