user

package
v0.0.310 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2026 License: Apache-2.0 Imports: 8 Imported by: 1

Documentation

Index

Constants

View Source
const (
	EmailKey          = "email"
	UsernameKey       = "username"
	UIDKey            = "uid"
	FirstNameKey      = "first_name"
	LastNameKey       = "last_name"
	PhoneKey          = "phone"
	CompanyNameKey    = "company_name"
	AddressKey        = "address"
	UserTypeKey       = "user_type"
	UserTypeSwitchKey = "user_type_switch"
	PrivacyKey        = "privacy"
	RestrictedKey     = "restricted"
	PictureIDKey      = "picture_id"
	QRIDKey           = "qr_id"
)
View Source
const (
	IsSearchableKey  = "is_searchable"
	IsMessageableKey = "is_messageable"
)
View Source
const (
	FullNameKey = "full_name"
)

Variables

View Source
var (
	PrivacyIsSearchableKey  = contract.PathKeyDot(PrivacyKey, IsSearchableKey)
	PrivacyIsMessageableKey = contract.PathKeyDot(PrivacyKey, IsMessageableKey)
)

Functions

This section is empty.

Types

type Comp

type Comp struct {
	FullName *string `json:"full_name" conform:"title,trim" validate:"nnpt,nz"`
}

func (*Comp) GetFullName added in v0.0.50

func (c *Comp) GetFullName() string

func (*Comp) SetFullName added in v0.0.50

func (c *Comp) SetFullName(x string)

type Core

type Core struct {
	address.Address `bson:",inline" validate:"recurse"`
	UID             *string            `json:"uid" validate:"nnpt"`
	Email           *string            `json:"email" conform:"email" validate:"nnpt,nz"`
	Username        *string            `json:"username" conform:"trim,lower" validate:"nnpt"`
	FirstName       *string            `json:"first_name" conform:"title,trim,alpha" validate:"nnpt,nz"`
	LastName        *string            `json:"last_name" conform:"title,trim,alpha" validate:"nnpt,nz"`
	Phone           *string            `json:"phone" conform:"trim" validate:"nnpt"`
	CompanyName     *string            `json:"company_name" conform:"title,trim" validate:"nnpt"`
	UserType        *contract.UserType `json:"user_type" conform:"lower,trim" validate:"nnpt,nz"`
	UserTypeSwitch  *contract.UserType `json:"user_type_switch" conform:"lower,trim" validate:"nnpt,nz"`
	Privacy         *Privacy           `json:"privacy" validate:"nnpt"`
	Restricted      *bool              `json:"restricted" validate:"nnpt"`
	PictureID       *contract.ID       `json:"picture_id" validate:"nnpt"`
	QRID            *contract.ID       `json:"qr_id" validate:"nnpt"`
	// WARN: ExternalOwner should be zero-valued if the user is not an external user.
	ExternalOwner *owner.Owner `bson:"external_owner" validate:"nnpt"`
}

func ApplyCore

func ApplyCore(c *Core, modifiers ...CoreOption) Core

func (*Core) GetCompanyName added in v0.0.50

func (c *Core) GetCompanyName() string

func (*Core) GetEmail

func (c *Core) GetEmail() string

func (*Core) GetExternalOwner added in v0.0.51

func (c *Core) GetExternalOwner() owner.Owner

func (*Core) GetFirstName added in v0.0.50

func (c *Core) GetFirstName() string

func (*Core) GetLastName added in v0.0.50

func (c *Core) GetLastName() string

func (*Core) GetPhone added in v0.0.50

func (c *Core) GetPhone() string

func (*Core) GetPictureID added in v0.0.50

func (c *Core) GetPictureID() contract.ID

func (*Core) GetPrivacy added in v0.0.50

func (c *Core) GetPrivacy() Privacy

func (*Core) GetQRID added in v0.0.102

func (c *Core) GetQRID() contract.ID

func (*Core) GetRestricted added in v0.0.50

func (c *Core) GetRestricted() bool

func (*Core) GetUID

func (c *Core) GetUID() string

func (*Core) GetUserType added in v0.0.50

func (c *Core) GetUserType() contract.UserType

func (*Core) GetUserTypeSwitch added in v0.0.63

func (c *Core) GetUserTypeSwitch() contract.UserType

func (*Core) GetUsername

func (c *Core) GetUsername() string

func (*Core) SetCompanyName added in v0.0.50

func (c *Core) SetCompanyName(x string)

func (*Core) SetEmail

func (c *Core) SetEmail(x string)

func (*Core) SetExternalOwner added in v0.0.51

func (c *Core) SetExternalOwner(x owner.Owner)

func (*Core) SetFirstName added in v0.0.50

func (c *Core) SetFirstName(x string)

func (*Core) SetLastName added in v0.0.50

func (c *Core) SetLastName(x string)

func (*Core) SetPhone added in v0.0.50

func (c *Core) SetPhone(x string)

func (*Core) SetPictureID added in v0.0.50

func (c *Core) SetPictureID(x contract.ID)

func (*Core) SetPrivacy added in v0.0.50

func (c *Core) SetPrivacy(x Privacy)

func (*Core) SetQRID added in v0.0.102

func (c *Core) SetQRID(x contract.ID)

func (*Core) SetRestricted added in v0.0.50

func (c *Core) SetRestricted(x bool)

func (*Core) SetUID

func (c *Core) SetUID(x string)

func (*Core) SetUserType added in v0.0.50

func (c *Core) SetUserType(x contract.UserType)

func (*Core) SetUserTypeSwitch added in v0.0.63

func (c *Core) SetUserTypeSwitch(x contract.UserType)

func (*Core) SetUsername

func (c *Core) SetUsername(x string)

type CoreOption

type CoreOption = contracti.CoreOption[Core]

func WithAddress added in v0.0.50

func WithAddress(x address.Address) CoreOption

func WithCompanyName added in v0.0.50

func WithCompanyName(x string) CoreOption

func WithEmail

func WithEmail(x string) CoreOption

func WithExternalOwner added in v0.0.51

func WithExternalOwner(x owner.Owner) CoreOption

func WithFirstName added in v0.0.50

func WithFirstName(x string) CoreOption

func WithLastName added in v0.0.50

func WithLastName(x string) CoreOption

func WithPhone added in v0.0.50

func WithPhone(x string) CoreOption

func WithPictureID added in v0.0.50

func WithPictureID(x contract.ID) CoreOption

func WithPrivacy added in v0.0.50

func WithPrivacy(x Privacy) CoreOption

func WithQRID added in v0.0.102

func WithQRID(x contract.ID) CoreOption

func WithRestricted added in v0.0.50

func WithRestricted(x bool) CoreOption

func WithUID

func WithUID(x string) CoreOption

func WithUserType added in v0.0.50

func WithUserType(x contract.UserType) CoreOption

func WithUserTypeSwitch added in v0.0.63

func WithUserTypeSwitch(x contract.UserType) CoreOption

func WithUsername

func WithUsername(x string) CoreOption

type Meta

type Meta struct {
	common.Common `bson:",inline" validate:"recurse"`
}

func ApplyMeta

func ApplyMeta(m *Meta, modifiers ...MetaOption) Meta

type MetaOption

type MetaOption = contract.MetaOption[Meta]

func WithCommon

func WithCommon(x common.Common) MetaOption

type Privacy added in v0.0.50

type Privacy struct {
	IsSearchable  *bool `json:"is_searchable" validate:"nnpt"`
	IsMessageable *bool `json:"is_messageable" validate:"nnpt"`
}

func (*Privacy) GetIsMessageable added in v0.0.50

func (p *Privacy) GetIsMessageable() bool

func (*Privacy) GetIsSearchable added in v0.0.50

func (p *Privacy) GetIsSearchable() bool

func (*Privacy) SetIsMessageable added in v0.0.50

func (p *Privacy) SetIsMessageable(x bool)

func (*Privacy) SetIsSearchable added in v0.0.50

func (p *Privacy) SetIsSearchable(x bool)

type User

type User struct {
	Meta `bson:",inline" validate:"recurse"`
	Comp `bson:",inline" validate:"recurse"`
	Core `bson:",inline" validate:"recurse"`
}

User represents a user.

func Mock

func Mock() *User

func MockWithComp added in v0.0.229

func MockWithComp() *User

func New

func New(m Meta, cr Core) *User

Jump to

Keyboard shortcuts

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