entity

package
v0.0.0-...-0b42950 Latest Latest
Warning

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

Go to latest
Published: Jan 12, 2022 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PGConstraintUniqueTokenAndTokenDate = "idx_unq_tokens_token_token_date"
)
View Source
const (
	PGErrCodeUniqueViolation = "23505"
)

Variables

View Source
var (
	ErrInputValidation = fmt.Errorf("validation input error")
)

Functions

func GenerateID

func GenerateID() string

GenerateID generates a unique ID that can be used as an identifier for an entity.

Types

type Input

type Input struct {
	CustomerID string `json:"customer_id" validate:"required,numeric,startswith=62,min=10"`
	Status     int    `json:"status" validate:"required"`
	Credential string `json:"credential" validate:"required,numeric,min=6,max=6"`
}

Input

type Metadata

type Metadata struct {
	ValidatedAt time.Time `json:"validated_at"`
}

func (*Metadata) Scan

func (m *Metadata) Scan(src interface{}) error

Scan stores the src in *m. No validation is done.

func (Metadata) Value

func (m Metadata) Value() (driver.Value, error)

Value returns m as a value. This does a validating unmarshal into another RawMessage. If m is invalid json, it returns an error.

type Output

type Output struct {
	ID         string `json:"id"`
	CustomerID string `json:"customer_id"`
	Status     int    `json:"status"`
	Credential string `json:"credential"`
}

OutGenerate .

type Pin

type Pin struct {
	ID         string    `db:"id" validate:"required,uuid"`
	CustomerID string    `db:"customer_id" validate:"required"`
	Status     int       `db:"status" validate:"required"`
	Credential string    `db:"credential" validate:"required"`
	CreatedAt  time.Time `db:"created_at" validate:"required"`
	UpdatedAt  time.Time `db:"updated_at" validate:"required"`
	Metadata   Metadata  `db:"metadata" validate:"-"`
}

pin struct is defined here

func NewPin

func NewPin() *Pin

type User

type User struct {
	ID   string
	Name string
}

User represents a user.

func (User) GetID

func (u User) GetID() string

GetID returns the user ID.

func (User) GetName

func (u User) GetName() string

GetName returns the user name.

Jump to

Keyboard shortcuts

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