
エントリーの編集

エントリーの編集は全ユーザーに共通の機能です。
必ずガイドラインを一読の上ご利用ください。
記事へのコメント1件
- 注目コメント
- 新着コメント
注目コメント算出アルゴリズムの一部にLINEヤフー株式会社の「建設的コメント順位付けモデルAPI」を使用しています

- バナー広告なし
- ミュート機能あり
- ダークモード搭載
関連記事
Golang のウェブフレームワーク martini で JSON をバリデーションするサンプル - Qiita
package main import ( "net/http" "github.com/codegangsta/martini" "github.com/martini-contrib/bin... package main import ( "net/http" "github.com/codegangsta/martini" "github.com/martini-contrib/binding" "github.com/martini-contrib/render" ) type Post struct { Title string `json:"title" binding:"required"` Content string `json:"content"` } func (p Post) Validate(errors *binding.Errors, req *http.Request) { if len(p.Title) < 4 { errors.Fields["title"] = "Too short; minimum 4 characters" } else if
2014/03/19 リンク