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") ErrDuplicateTokenPerDate = fmt.Errorf("duplicate token generated in current date") )
Functions ¶
func GenerateID ¶
func GenerateID() string
GenerateID generates a unique ID that can be used as an identifier for an entity.
Types ¶
type InputGenerate ¶
type InputGenerate struct {
CustomerID string `json:"customer_id" validate:"required,numeric,startswith=62,min=10"`
}
InputGenerate .
type InputPutToken ¶
type InputPutToken struct { CustomerID string `json:"customer_id" validate:"required,numeric,startswith=62,min=10"` Token string `json:"token" validate:"required"` }
PutToken
type InputValidate ¶
type InputValidate struct {
Token string `json:"token" validate:"required"`
}
InputValidate .
type OutGenerate ¶
OutGenerate .
type OutValidate ¶
type OutValidate struct { Token string `json:"token"` CustomerID string `json:"customer_id"` ValidUntil time.Time `json:"valid_until"` IsExpired bool `json:"is_expired"` IsValidated bool `json:"is_validated"` }
OutValidate .
type PayToken ¶
type PayToken struct { ID string `db:"id" validate:"required,uuid"` Token string `db:"token" validate:"required,max=10"` TokenDate time.Time `db:"token_date" validate:"required"` CustomerID string `db:"customer_id" validate:"required"` ValidUntil time.Time `db:"valid_until" validate:"required"` CreatedAt time.Time `db:"created_at" validate:"required"` UpdatedAt time.Time `db:"updated_at" validate:"required"` Metadata Metadata `db:"metadata" validate:"-"` }
PayToken struct is defined here
Click to show internal directories.
Click to hide internal directories.