Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
48 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package model | ||
|
||
import validation "github.com/go-ozzo/ozzo-validation" | ||
|
||
func (r UpdateUser) Validate() error { | ||
return validation.ValidateStruct(&r, | ||
validation.Field( | ||
&r.DisplayName, | ||
validation.Required.Error("名前の入力は必須です"), | ||
validation.RuneLength(1, 30).Error("名前は最大30文字までです"), | ||
), | ||
) | ||
} | ||
|
||
func (r NewItem) Validate() error { | ||
return validation.ValidateStruct(&r, | ||
validation.Field( | ||
&r.Title, | ||
validation.Required.Error("タイトルの入力は必須です"), | ||
validation.RuneLength(1, 100).Error("タイトルは最大100文字までです"), | ||
), | ||
) | ||
} | ||
|
||
func (r UpdateItem) Validate() error { | ||
return validation.ValidateStruct(&r, | ||
validation.Field( | ||
&r.Title, | ||
validation.Required.Error("タイトルの入力は必須です"), | ||
validation.RuneLength(1, 100).Error("タイトルは最大100文字までです"), | ||
), | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters