<commit_before>// Description: model
// Author: <NAME>
// Since: 2016-02-28 20:59
package param

import (
	"fmt"
	"github.com/gin-gonic/gin"
	"strconv"
)

// MustInt try to extract value from request param by the givin key,
// if failed will raise a panic
func MustInt(c *gin.Context, key string) int {
	if strv := c.Param(key); strv != "" {
		v, e := strconv.Atoi(strv)
		if e != nil {
			panic(e)
		}
		return v
	} else {
		panic(fmt.Sprintf("cannot get value of param [%s]", key))
	}
}

// Int try to extract value from request param by the givin key,<commit_msg>update~~<commit_after>// Description: model
// Author: <NAME>
// Since: 2016-02-28 20:59
package param

import (
	"github.com/gin-gonic/gin"
	"strconv"
)

// MustInt try to extract value from request param by the givin key,
// if failed will return the default value
func MustInt(c *gin.Context, key string, defaultValue int) int {
	strv := c.Param(key)
	v, e := strconv.Atoi(strv)
	if e != nil {
		v = defaultValue
	}
	return v
}

// Int try to extract value from request param by the givin key,
{'fraction_non_alphanumeric': 0.1337099811676083, 'fraction_numerical': 0.022598870056497175, 'mean_word_length': 3.321138211382114, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3264293', 'n_tokens_mistral': 418, 'n_tokens_neox': 394, 'n_words': 134}