person

package
v0.18.3 Latest Latest
Warning

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

Go to latest
Published: Jun 6, 2024 License: MIT Imports: 7 Imported by: 24

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CleanForID added in v0.13.0

func CleanForID(s string) string

CleanForID removes non-ASCII characters and converts to a lower case

func DeductNamesFromFullName added in v0.17.0

func DeductNamesFromFullName(fullName string) (firstName, lastName string)

func GenerateIDFromNameOrRandom added in v0.13.0

func GenerateIDFromNameOrRandom(name *NameFields, existingIDs []string) (id string, err error)

GenerateIDFromNameOrRandom generates ContactID from name or random

func NewUniqueRandomID added in v0.13.0

func NewUniqueRandomID(existingIDs []string, idLength int) (id string, err error)

NewUniqueRandomID generate new team ContactID

func ValidateAtLeast1Name

func ValidateAtLeast1Name(v *NameFields) error

ValidateAtLeast1Name validates required names

Types

type Name

type Name struct {
	Field NameField
	Value string
}

Name is a struct for setting names of a user or a contact

type NameField

type NameField int
const (
	Username NameField = iota
	FirstName
	MiddleName
	LastName
	NickName
	FullName
)

type NameFields

type NameFields struct {
	UserName   string `json:"userName,omitempty" dalgo:"userName,omitempty" firestore:"userName,omitempty"`
	FirstName  string `json:"firstName,omitempty" dalgo:"firstName,omitempty" firestore:"firstName,omitempty"`
	MiddleName string `json:"middleName,omitempty" dalgo:"middleName,omitempty" firestore:"middleName,omitempty"`
	LastName   string `json:"lastName,omitempty" dalgo:"lastName,omitempty" firestore:"lastName,omitempty"`
	NickName   string `json:"nickName,omitempty" dalgo:"nickName,omitempty" firestore:"nickName,omitempty"`
	FullName   string `json:"fullName,omitempty" dalgo:"fullName,omitempty" firestore:"fullName,omitempty"`
}

NameFields is a struct for storing names of a user or a contact

func (*NameFields) Equal added in v0.14.0

func (v *NameFields) Equal(v2 *NameFields) bool

func (*NameFields) GetFullName

func (v *NameFields) GetFullName() string

GetFullName returns a full NameField of a user or a contact

func (*NameFields) GetName

func (v *NameFields) GetName(field NameField) string

GetName returns a long NameField of a user or a contact

func (*NameFields) IsEmpty added in v0.14.1

func (v *NameFields) IsEmpty() bool

IsEmpty checks if name is empty

func (*NameFields) SetNames

func (v *NameFields) SetNames(names ...Name) error

SetNames sets names of a user or a contact

func (*NameFields) String

func (v *NameFields) String() string

String returns string representation of a user or a contact names

func (*NameFields) Validate

func (v *NameFields) Validate() error

Validate validates NameField fields

type NamesHolder

type NamesHolder interface {
	SetNames(names ...Name) error
	GetName(field NameField) string
}

Jump to

Keyboard shortcuts

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