d2c5daa5 by Jianbo Feng

Update comments for controller's GetXXX functions

1 parent daf85f06
...@@ -363,7 +363,7 @@ func (c *Controller) ParseForm(obj interface{}) error { ...@@ -363,7 +363,7 @@ func (c *Controller) ParseForm(obj interface{}) error {
363 return ParseForm(c.Input(), obj) 363 return ParseForm(c.Input(), obj)
364 } 364 }
365 365
366 // GetString returns the input value by key string. 366 // GetString returns the input value by key string or the default value while it's present and input is blank
367 func (c *Controller) GetString(key string, def ...string) string { 367 func (c *Controller) GetString(key string, def ...string) string {
368 var defv string 368 var defv string
369 if len(def) > 0 { 369 if len(def) > 0 {
...@@ -377,7 +377,7 @@ func (c *Controller) GetString(key string, def ...string) string { ...@@ -377,7 +377,7 @@ func (c *Controller) GetString(key string, def ...string) string {
377 } 377 }
378 } 378 }
379 379
380 // GetStrings returns the input string slice by key string. 380 // GetStrings returns the input string slice by key string or the default value while it's present and input is blank
381 // it's designed for multi-value input field such as checkbox(input[type=checkbox]), multi-selection. 381 // it's designed for multi-value input field such as checkbox(input[type=checkbox]), multi-selection.
382 func (c *Controller) GetStrings(key string, def ...[]string) []string { 382 func (c *Controller) GetStrings(key string, def ...[]string) []string {
383 var defv []string 383 var defv []string
...@@ -398,7 +398,7 @@ func (c *Controller) GetStrings(key string, def ...[]string) []string { ...@@ -398,7 +398,7 @@ func (c *Controller) GetStrings(key string, def ...[]string) []string {
398 } 398 }
399 } 399 }
400 400
401 // GetInt returns input as an int 401 // GetInt returns input as an int or the default value while it's present and input is blank
402 func (c *Controller) GetInt(key string, def ...int) (int, error) { 402 func (c *Controller) GetInt(key string, def ...int) (int, error) {
403 var defv int 403 var defv int
404 if len(def) > 0 { 404 if len(def) > 0 {
...@@ -412,7 +412,7 @@ func (c *Controller) GetInt(key string, def ...int) (int, error) { ...@@ -412,7 +412,7 @@ func (c *Controller) GetInt(key string, def ...int) (int, error) {
412 } 412 }
413 } 413 }
414 414
415 // GetInt8 return input as an int8 415 // GetInt8 return input as an int8 or the default value while it's present and input is blank
416 func (c *Controller) GetInt8(key string, def ...int8) (int8, error) { 416 func (c *Controller) GetInt8(key string, def ...int8) (int8, error) {
417 var defv int8 417 var defv int8
418 if len(def) > 0 { 418 if len(def) > 0 {
...@@ -428,7 +428,7 @@ func (c *Controller) GetInt8(key string, def ...int8) (int8, error) { ...@@ -428,7 +428,7 @@ func (c *Controller) GetInt8(key string, def ...int8) (int8, error) {
428 } 428 }
429 } 429 }
430 430
431 // GetInt16 returns input as an int16 431 // GetInt16 returns input as an int16 or the default value while it's present and input is blank
432 func (c *Controller) GetInt16(key string, def ...int16) (int16, error) { 432 func (c *Controller) GetInt16(key string, def ...int16) (int16, error) {
433 var defv int16 433 var defv int16
434 if len(def) > 0 { 434 if len(def) > 0 {
...@@ -445,7 +445,7 @@ func (c *Controller) GetInt16(key string, def ...int16) (int16, error) { ...@@ -445,7 +445,7 @@ func (c *Controller) GetInt16(key string, def ...int16) (int16, error) {
445 } 445 }
446 } 446 }
447 447
448 // GetInt32 returns input as an int32 448 // GetInt32 returns input as an int32 or the default value while it's present and input is blank
449 func (c *Controller) GetInt32(key string, def ...int32) (int32, error) { 449 func (c *Controller) GetInt32(key string, def ...int32) (int32, error) {
450 var defv int32 450 var defv int32
451 if len(def) > 0 { 451 if len(def) > 0 {
...@@ -461,7 +461,7 @@ func (c *Controller) GetInt32(key string, def ...int32) (int32, error) { ...@@ -461,7 +461,7 @@ func (c *Controller) GetInt32(key string, def ...int32) (int32, error) {
461 } 461 }
462 } 462 }
463 463
464 // GetInt64 returns input value as int64. 464 // GetInt64 returns input value as int64 or the default value while it's present and input is blank.
465 func (c *Controller) GetInt64(key string, def ...int64) (int64, error) { 465 func (c *Controller) GetInt64(key string, def ...int64) (int64, error) {
466 var defv int64 466 var defv int64
467 if len(def) > 0 { 467 if len(def) > 0 {
...@@ -475,7 +475,7 @@ func (c *Controller) GetInt64(key string, def ...int64) (int64, error) { ...@@ -475,7 +475,7 @@ func (c *Controller) GetInt64(key string, def ...int64) (int64, error) {
475 } 475 }
476 } 476 }
477 477
478 // GetBool returns input value as bool. 478 // GetBool returns input value as bool or the default value while it's present and input is blank.
479 func (c *Controller) GetBool(key string, def ...bool) (bool, error) { 479 func (c *Controller) GetBool(key string, def ...bool) (bool, error) {
480 var defv bool 480 var defv bool
481 if len(def) > 0 { 481 if len(def) > 0 {
...@@ -489,7 +489,7 @@ func (c *Controller) GetBool(key string, def ...bool) (bool, error) { ...@@ -489,7 +489,7 @@ func (c *Controller) GetBool(key string, def ...bool) (bool, error) {
489 } 489 }
490 } 490 }
491 491
492 // GetFloat returns input value as float64. 492 // GetFloat returns input value as float64 or the default value while it's present and input is blank.
493 func (c *Controller) GetFloat(key string, def ...float64) (float64, error) { 493 func (c *Controller) GetFloat(key string, def ...float64) (float64, error) {
494 var defv float64 494 var defv float64
495 if len(def) > 0 { 495 if len(def) > 0 {
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!