1 package lduser 2 3 import ( 4 "github.com/launchdarkly/go-sdk-common/v3/ldcontext" 5 ) 6 7 // User is an alias for the type [ldcontext.Context], representing an evaluation context. 8 // 9 // This is provided as a compatibility helper for application code written for older SDK versions, 10 // which used users instead of contexts. See package comments for [lduser]. 11 type User = ldcontext.Context 12 13 // UserAttribute is a string type representing the name of a user attribute. 14 // 15 // Constants like KeyAttribute describe all of the built-in attributes that existed in the older 16 // user model; you may also cast any string to UserAttribute when referencing a custom attribute 17 // name. In the newer context model, none of these attribute names except for "key", "name", and 18 // "anonymous" have any special significance. 19 type UserAttribute string 20 21 const ( 22 // KeyAttribute is the standard attribute name corresponding to UserBuilder.Key. 23 KeyAttribute UserAttribute = "key" 24 // SecondaryKeyAttribute is the standard attribute name corresponding to User.GetSecondaryKey(). 25 SecondaryKeyAttribute UserAttribute = "secondary" 26 // IPAttribute is the standard attribute name corresponding to UserBuilder.IP. 27 IPAttribute UserAttribute = "ip" 28 // CountryAttribute is the standard attribute name corresponding to UserBuilder.Country. 29 CountryAttribute UserAttribute = "country" 30 // EmailAttribute is the standard attribute name corresponding to UserBuilder.Email. 31 EmailAttribute UserAttribute = "email" 32 // FirstNameAttribute is the standard attribute name corresponding to UserBuilder.FirstName. 33 FirstNameAttribute UserAttribute = "firstName" 34 // LastNameAttribute is the standard attribute name corresponding to UserBuilder.LastName. 35 LastNameAttribute UserAttribute = "lastName" 36 // AvatarAttribute is the standard attribute name corresponding to UserBuilder.Avatar. 37 AvatarAttribute UserAttribute = "avatar" 38 // NameAttribute is the standard attribute name corresponding to UserBuilder.Name. 39 NameAttribute UserAttribute = "name" 40 // AnonymousAttribute is the standard attribute name corresponding to UserBuilder.Anonymous. 41 AnonymousAttribute UserAttribute = "anonymous" 42 ) 43