Documentation ¶
Index ¶
Constants ¶
View Source
const ( RequiredTag = "required" EqFieldTag = "eqfield" MinTag = "min" MaxTag = "max" Base64Tag = "base64" EmailTag = "email" HiraganaTag = "hiragana" PasswordTag = "password" UniqueTag = "unique" LessThanTag = "lt" LessThanEqualTag = "lte" GreaterThanTag = "gt" GreaterThanEqualTag = "gte" OneOfTag = "oneof" )
バリデーションタグ
View Source
const ( RequiredMessage = "is required" EqFieldMessage = "does not match %s" MinMessage = "must be at least %s characters" MaxMessage = "must be at %s or less characters" Base64Message = "should be in base64 format" EmailMessage = "should be in email format" HiraganaMessage = "should be in hiragana format" PasswordMessage = "should be in password format" UniqueMessage = "must be unique" LessThanMessage = "must be at less than %s" LessThanEuqalMessage = "must be at less than or equal to %s" GreaterThanMessage = "must be at greater than %s" GreaterThanEqualMessage = "must be at greater than or equal to %s" OneOfMessage = "must be one of %s" )
バリデーションメッセージ
View Source
const ( CustomUniqueMessage = "already exists" UnableConvertBase64Massage = "cannot be converted to base64" )
カスタムバリデーションメッセージ
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CustomError ¶
type CustomError struct { ErrorCode ErrorCode Value error ValidationErrors []*ValidationError }
CustomError - エラーコードを含めた構造体
func (CustomError) Validations ¶
func (ce CustomError) Validations() []*ValidationError
Validations - バリデーションエラーの詳細を返す
type ErrorCode ¶
type ErrorCode uint
ErrorCode - システムエラーの種類
const ( // Unknown - 不明なエラー Unknown ErrorCode = iota // ErrorInDatastore - データストアでのエラー ErrorInDatastore // ErrorInStorage - ストレージでのエラー ErrorInStorage // ErrorInOtherAPI - 他のAPIでのエラー ErrorInOtherAPI // InvalidDomainValidation - ドメイン層でのバリデーションエラー InvalidDomainValidation // InvalidRequestValidation - リクエスト値のバリデーションエラ InvalidRequestValidation // UnableConvertBase64 - Byte64型への変換エラー UnableConvertBase64 Unauthorized // Expired - セッションが有効期限切れ Expired // Forbidden - 権限エラー Forbidden // NotFound - 取得エラー NotFound // NotExistsInDatastore - データストアに対象のレコードが存在しない NotExistsInDatastore // NotExistsInStorage - ストレージに対象のファイルが存在しない NotExistsInStorage // Conflict - 既存レコード,ファイルとの競合 Conflict )
type ValidationError ¶
ValidationError - バリデーションエラー用構造体
Click to show internal directories.
Click to hide internal directories.