entity

package
v0.0.0-...-3407765 Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2022 License: MIT Imports: 3 Imported by: 1

Documentation

Index

Constants

View Source
const (
	HashVerificationAccountTypeVerify    = "Verify Your Email"
	HashVerificationAccountTypeResetPass = "Reset Your Password"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Account

type Account struct {
	AccountPublic
	Password string ` json:"password" db:"password" gorm:"type:varchar(255)"`
}

func (Account) TableName

func (a Account) TableName() string

type AccountPublic

type AccountPublic struct {
	Base
	Email      string `json:"email" tsense_default_sort:"1" tsense_sort:"1" db:"email" gorm:"type:varchar(255);index;unique"`
	IsVerified bool   `json:"is_verified" db:"is_verified"`
	IsSSO      bool   `json:"is_sso" db:"is_sso"` // is an sso account
	SSOType    string `json:"sso_type" db:"sso_type"`
}

func (AccountPublic) GetAccountID

func (a AccountPublic) GetAccountID() string

type Base

type Base struct {
	ID        string          `json:"id" db:"id" gorm:"type:VARCHAR(100);primary"`
	CreatedAt types.Timestamp `json:"created_at" db:"created_at"`
	UpdatedAt types.Timestamp `json:"updated_at" db:"updated_at"`
	IsDeleted bool            `json:"is_deleted" db:"is_deleted" gorm:"type:TINYINT(1);index"`
}

Base : attach this as a base model using uuid

func (Base) GetID

func (b Base) GetID() string

func (Base) GetIDKey

func (b Base) GetIDKey() string

func (*Base) New

func (b *Base) New()

type BaseOwned

type BaseOwned struct {
	Base
	AccountID string `json:"account_id" db:"account_id" gorm:"type:VARCHAR(255);index"`
}

BaseOwned : use this for entities that are owned and need to have an account to own them

func (BaseOwned) GetAccountID

func (b BaseOwned) GetAccountID() string

type HashVerificationAccount

type HashVerificationAccount struct {
	ID          string    `json:"id" db:"id" gorm:"type:varchar(255);primary"`
	AccountID   string    `json:"account_id" db:"account_id" gorm:"type:varchar(255)"`
	Email       string    `json:"email" db:"email" gorm:"type:varchar(255)"`
	TTLExpiry   time.Time `json:"ttl_expiry" db:"ttl_expiry"`
	Type        string    `json:"type" db:"type" gorm:"type:varchar(40)"`
	HasBeenUsed bool      `json:"has_been_used" db:"has_been_used"`
}

func (HashVerificationAccount) GetAccountID

func (h HashVerificationAccount) GetAccountID() string

GetAccountID : return back the account id for the record

func (HashVerificationAccount) GetID

func (h HashVerificationAccount) GetID() string

func (HashVerificationAccount) GetIDKey

func (h HashVerificationAccount) GetIDKey() string

GetIDKey : return the id column name ie your "db" tag

func (HashVerificationAccount) TableName

func (h HashVerificationAccount) TableName() string

type Model

type Model interface {
	// GetID : return back the id value
	GetID() string
	// GetIDKey : return the id column name ie your "db" tag
	GetIDKey() string // primary index
	// GetAccountID : return back the account id for the record
	GetAccountID() string
	// TableName : return back the table name
	TableName() string // table name or e
}

Model : a model definition that can be used by a repository

type Session

type Session struct {
	BaseOwned
	ExpiresAt time.Time `json:"expires_at" db:"expires_at"`
}

func (Session) TableName

func (s Session) TableName() string

Jump to

Keyboard shortcuts

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