models

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2022 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrInvalidEmail defines the error when an invalid email address is encountered
	ErrInvalidEmail = errors.New("invalid email")
)

Functions

func ValidateEmail

func ValidateEmail(email string, modified bool) error

ValidateEmail validates the provided email address. If is was modified this function also accepts empty addresses (= no change)

Types

type Scope

type Scope int

Scope describes the git config scope (local or global)

const (
	// Global defines the global git config scope
	Global Scope = iota

	// Local defines the local git config scope
	Local
)

func (Scope) Arg

func (s Scope) Arg() string

Arg returns the argument representation of the scope

func (Scope) String

func (s Scope) String() string

String returns the string representation of the scope

type User

type User struct {
	Name       string    `json:"name"`
	Email      string    `json:"email"`
	Alias      string    `json:"alias"`
	GpgKeyID   string    `json:"gpg_key_id"`
	AddedAt    time.Time `json:"added_at"`
	ModifiedAt time.Time `json:"modified_at"`
}

User describes the structure of the user JSON data

func NewUser

func NewUser(name, email, alias, gpgKeyID string) *User

NewUser returns a new user

func (*User) Format

func (u *User) Format(padding int) string

Format formats user profile data as a string

func (*User) Modify

func (u *User) Modify(name, email, alias, gpgKeyID string)

Modify updates fields if there are changes. It also updated the 'ModifiedAt' field accordingly

Jump to

Keyboard shortcuts

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