model

package
v0.9.1 Latest Latest
Warning

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

Go to latest
Published: May 30, 2022 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

Functions

This section is empty.

Types

type BooleanExpression

type BooleanExpression struct {
	// Equals value
	Eq *bool `json:"_eq"`
	// Is value null (true) or not null (false)
	IsNull *bool `json:"_is_null"`
	// Does not equal value
	Neq *bool `json:"_neq"`
}

type CreateUserForm

type CreateUserForm struct {
	Email    *string `json:"email"`
	Phone    *string `json:"phone"`
	Password *string `json:"password"`
	Name     *string `json:"name"`
	Avatar   *string `json:"avatar"`
	Confirm  *bool   `json:"confirm"`
	Data     Object  `json:"data"`
}

type FloatExpression added in v0.7.1

type FloatExpression struct {
	// Equals value
	Eq *float64 `json:"_eq"`
	// Does not equal value
	Neq *float64 `json:"_neq"`
	// Is greater than value
	Gt *float64 `json:"_gt"`
	// Is greater than or equals value
	Gte *float64 `json:"_gte"`
	// Is value null (true) or not null (false)
	IsNull *bool `json:"_is_null"`
	// Is lesser than value
	Lt *float64 `json:"_lt"`
	// Is lesser than or equals value
	Lte *float64 `json:"_lte"`
}

type IntExpression added in v0.7.1

type IntExpression struct {
	// Equals value
	Eq *int `json:"_eq"`
	// Does not equal value
	Neq *int `json:"_neq"`
	// Is greater than value
	Gt *int `json:"_gt"`
	// Is greater than or equals value
	Gte *int `json:"_gte"`
	// Is value null (true) or not null (false)
	IsNull *bool `json:"_is_null"`
	// Is lesser than value
	Lt *int `json:"_lt"`
	// Is lesser than or equals value
	Lte *int `json:"_lte"`
}

type Log

type Log struct {
	UserID    string
	Event     string
	At        time.Time
	IPAddress string
	UserAgent string
	AdminID   *string
}

func NewLog

func NewLog(user_id string, event string, ip string, admin_id *string, ua string) Log

func (*Log) Create

func (l *Log) Create(tx *gorm.DB) error

type LoginResponse

type LoginResponse struct {
	AccessToken  string `json:"access_token"`
	RefreshToken string `json:"refresh_token"`
	ID           string `json:"id"`
}

type Object added in v0.2.0

type Object map[string]interface{}

func (Object) GormDBDataType added in v0.2.0

func (Object) GormDBDataType(db *gorm.DB, field *schema.Field) string

func (Object) GormDataType added in v0.2.0

func (Object) GormDataType() string

func (Object) MarshalGQL added in v0.2.0

func (o Object) MarshalGQL(w io.Writer)

func (*Object) Scan added in v0.2.0

func (o *Object) Scan(v interface{}) error

func (*Object) UnmarshalGQL added in v0.2.0

func (o *Object) UnmarshalGQL(v interface{}) error

func (Object) Validate added in v0.2.0

func (o Object) Validate(schema map[string]config.Field) error

func (Object) Value added in v0.2.0

func (o Object) Value() (driver.Value, error)

type OrderDirection

type OrderDirection string
const (
	// Ascending
	OrderDirectionAsc OrderDirection = "asc"
	// Descending
	OrderDirectionDesc OrderDirection = "desc"
)

func (OrderDirection) IsValid

func (e OrderDirection) IsValid() bool

func (OrderDirection) MarshalGQL

func (e OrderDirection) MarshalGQL(w io.Writer)

func (OrderDirection) String

func (e OrderDirection) String() string

func (*OrderDirection) UnmarshalGQL

func (e *OrderDirection) UnmarshalGQL(v interface{}) error

type RefreshToken

type RefreshToken struct {
	ID        uint64 `gorm:"autoIncrement"`
	Token     string
	UserID    string
	CreatedAt time.Time
	UpdatedAt *time.Time
	User      *User
}

func (*RefreshToken) Create

func (r *RefreshToken) Create(tx *gorm.DB) error

func (*RefreshToken) Save

func (r *RefreshToken) Save(tx *gorm.DB) error

type SignupForm

type SignupForm struct {
	Name     *string `json:"name"`
	Avatar   *string `json:"avatar"`
	Email    *string `json:"email"`
	Phone    *string `json:"phone"`
	Password string  `json:"password"`
	Data     Object  `json:"data"`
}

type StringExpression

type StringExpression struct {
	// Equals value
	Eq *string `json:"_eq"`
	// Does not equal value
	Neq *string `json:"_neq"`
	// Is greater than value
	Gt *string `json:"_gt"`
	// Is greater than or equals value
	Gte *string `json:"_gte"`
	// Value matching pattern where '%' represents zero or more characters and '_' represents a single character. Eg. '_r%' finds values having 'r' in second position
	Like *string `json:"_like"`
	// Value matching (case-insensitive) pattern where '%' represents zero or more characters and '_' represents a single character. Eg. '_r%' finds values having 'r' in second position
	Ilike *string `json:"_ilike"`
	// Value not matching pattern where '%' represents zero or more characters and '_' represents a single character. Eg. '_r%' finds values not having 'r' in second position
	Nlike *string `json:"_nlike"`
	// Value not matching (case-insensitive) pattern where '%' represents zero or more characters and '_' represents a single character. Eg. '_r%' finds values not having 'r' in second position
	Nilike *string `json:"_nilike"`
	// Is value null (true) or not null (false)
	IsNull *bool `json:"_is_null"`
	// Is lesser than value
	Lt *string `json:"_lt"`
	// Is lesser than or equals value
	Lte *string `json:"_lte"`
}

type TimeExpression added in v0.7.1

type TimeExpression struct {
	// Equals value
	Eq *string `json:"_eq"`
	// Does not equal value
	Neq *string `json:"_neq"`
	// Is greater than value
	Gt *string `json:"_gt"`
	// Is greater than or equals value
	Gte *string `json:"_gte"`
	// Is value null (true) or not null (false)
	IsNull *bool `json:"_is_null"`
	// Is lesser than value
	Lt *string `json:"_lt"`
	// Is lesser than or equals value
	Lte *string `json:"_lte"`
}

type User

type User struct {
	Config *config.Config `json:"-" gorm:"-"`

	ID                           string     `json:"id,omitempty" gorm:"autoIncrement"`
	Email                        *string    `json:"email,omitempty"`
	Phone                        *string    `json:"phone,omitempty"`
	Name                         *string    `json:"name,omitempty"`
	Avatar                       *string    `json:"avatar,omitempty"`
	EmailConfirmed               bool       `json:"email_confirmed,omitempty"`
	EmailConfirmationTokenSentAt *time.Time `json:"email_confirmation_token_sent_at,omitempty"`
	EmailConfirmedAt             *time.Time `json:"email_confirmed_at,omitempty"`
	PhoneConfirmed               bool       `json:"phone_confirmed,omitempty"`
	PhoneConfirmationTokenSentAt *time.Time `json:"phone_confirmation_token_sent_at,omitempty"`
	PhoneConfirmedAt             *time.Time `json:"phone_confirmed_at,omitempty"`
	RecoveryTokenSentAt          *time.Time `json:"recovery_token_sent_at,omitempty"`
	EmailChangeTokenSentAt       *time.Time `json:"email_change_token_sent_at,omitempty"`
	PhoneChangeTokenSentAt       *time.Time `json:"phone_change_token_sent_at,omitempty"`
	LastSigninAt                 *time.Time `json:"last_signin_at,omitempty"`
	CreatedAt                    time.Time  `json:"created_at,omitempty"`
	UpdatedAt                    time.Time  `json:"updated_at,omitempty"`
	NewEmail                     *string    `json:"new_email,omitempty"`
	NewPhone                     *string    `json:"new_phone,omitempty"`
	PhoneChangedAt               *time.Time `json:"phone_changed_at,omitempty"`
	EmailChangedAt               *time.Time `json:"email_changed_at,omitempty"`
	PasswordChangedAt            *time.Time `json:"password_changed_at,omitempty"`
	IncorrectLoginAttempts       int        `json:"incorrect_login_attempts,omitempty"`
	LastIncorrectLoginAttemptAt  *time.Time `json:"last_incorrect_login_attempt_at,omitempty"`
	Password                     *string    `json:"-"`
	EmailConfirmationToken       *string    `json:"-"`
	PhoneConfirmationToken       *string    `json:"-"`
	RecoveryToken                *string    `json:"-"`
	EmailChangeToken             *string    `json:"-"`
	PhoneChangeToken             *string    `json:"-"`
	Data                         *Object    `json:"data,omitempty"`
}

func NewUser added in v0.8.0

func NewUser(c *config.Config) *User

func (*User) AcceptEmailInvite

func (u *User) AcceptEmailInvite(tx *gorm.DB, log Log) error

func (*User) AcceptPhoneInvite

func (u *User) AcceptPhoneInvite(tx *gorm.DB, log Log) error

func (*User) AccountUnlockedAt added in v0.8.0

func (u *User) AccountUnlockedAt() time.Time

func (*User) ChangeEmail

func (u *User) ChangeEmail(tx *gorm.DB, log Log, email string) error

func (*User) ChangePassword

func (u *User) ChangePassword(tx *gorm.DB, log Log, password string, cost int) error

func (*User) ChangePhone

func (u *User) ChangePhone(tx *gorm.DB, log Log, phone string) error

func (*User) ConfirmEmail

func (u *User) ConfirmEmail(tx *gorm.DB, log Log) error

func (*User) ConfirmEmailChange

func (u *User) ConfirmEmailChange(tx *gorm.DB, log Log) error

func (*User) ConfirmPhone

func (u *User) ConfirmPhone(tx *gorm.DB, log Log) error

func (*User) ConfirmPhoneChange

func (u *User) ConfirmPhoneChange(tx *gorm.DB, log Log) error

func (*User) ConfirmReset

func (u *User) ConfirmReset(tx *gorm.DB, log Log) error

func (*User) Create

func (u *User) Create(db *gorm.DB) error

func (*User) CreateWithLog added in v0.8.0

func (u *User) CreateWithLog(tx *gorm.DB, log *Log) error

func (*User) FinishedLoginAttempts added in v0.8.0

func (u *User) FinishedLoginAttempts() bool

func (*User) IncorrectAttempt

func (u *User) IncorrectAttempt(tx *gorm.DB, log Log) error

func (*User) InitEmailConfirmation

func (u *User) InitEmailConfirmation(tx *gorm.DB) error

func (*User) InitPhoneConfirmation

func (u *User) InitPhoneConfirmation(tx *gorm.DB) error

func (*User) InviteByEmail

func (u *User) InviteByEmail(tx *gorm.DB, name string, email string) error

func (*User) InviteByPhone

func (u *User) InviteByPhone(tx *gorm.DB, name string, phone string) error

func (*User) ResetAttempt

func (u *User) ResetAttempt(tx *gorm.DB) error

func (*User) ResetByEmail

func (u *User) ResetByEmail(tx *gorm.DB, log Log) error

func (*User) ResetByPhone

func (u *User) ResetByPhone(tx *gorm.DB, log Log) error

func (*User) Save

func (u *User) Save(tx *gorm.DB) error

func (*User) SaveWithLog

func (u *User) SaveWithLog(tx *gorm.DB, log *Log) error

func (*User) SetPassword

func (u *User) SetPassword(password string, cost int) error

func (*User) SignedIn

func (u *User) SignedIn(tx *gorm.DB, log Log) error

func (*User) VerifyPassword

func (u *User) VerifyPassword(password string) error

Jump to

Keyboard shortcuts

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