Documentation ¶
Index ¶
- Constants
- Variables
- func AbsolutizeURL(req *http.Request, uri string) string
- func ConcatXML(fileNames []string) ([]byte, [sha1.Size]byte)
- func ConvertMethodName(val string) string
- func ConvertModelName(val string) string
- func GetLogger(moduleName string) log15.Logger
- func GetStructFieldByJSONTag(structValue reflect.Value, tag string) (sf reflect.Value)
- func ListStaticFiles(subDir string, modules []string) []string
- func Log15ForGin(logger log15.Logger) gin.HandlerFunc
- func LogAndPanic(log log15.Logger, msg string, ctx ...interface{})
- func SnakeCaseString(in string) string
- func UnmarshalJSONValue(data, dst reflect.Value) error
- type Context
- type Digits
- type FieldType
- type LangDirection
- type LangParameters
Constants ¶
const (
SUPERUSER_ID int64 = 1
)
Variables ¶
var Config *viper.Viper
Functions ¶
func AbsolutizeURL ¶
AbsolutizeURL returns an absolute URL from the given URI and http.Request
func ConcatXML ¶
ConcatXML concatenates the XML content of the files given by fileNames into a valid XML by importing all children of the root node into the root node of the first file.
func ConvertMethodName ¶
ConvertMethodName converts an Odoo snake style method name (e.g. search_read) into a YEP Pascal cased style (e.g. SearchRead).
func ConvertModelName ¶
ConvertModelName converts an Odoo dotted style model name (e.g. res.partner) into a YEP Pascal cased style (e.g. ResPartner).
func GetStructFieldByJSONTag ¶
GetStructFieldByJSONTag returns a pointer value of the struct field of the given structValue with the given JSON tag. If several are found, it returns the first one. If none are found it returns the zero value. If structType is not a Type of Kind struct, then it panics.
func ListStaticFiles ¶
ListStaticFiles get all file names of the static files that are in the "server/static/*/<subDir>" directories.
func Log15ForGin ¶
func Log15ForGin(logger log15.Logger) gin.HandlerFunc
Log15ForGin returns a gin.HandlerFunc (middleware) that logs requests using log15.
Requests with errors are logged using log15.Error(). Requests without errors are logged using log15.Info().
func LogAndPanic ¶
LogAndPanic is a helper function for logging an error message on the given logger and then panic with the same error message.
func SnakeCaseString ¶
SnakeCaseString convert the given string to snake case following the Golang format: acronyms are converted to lower-case and preceded by an underscore.
func UnmarshalJSONValue ¶
UnmarshalJSONValue unmarshals the given data as a Value of type []byte into the dst Value. dst must be a pointer Value
Types ¶
type Context ¶
type Context map[string]interface{}
Context is a map of objects that is passed along from function to function during a transaction.
type Digits ¶
type Digits [2]int
Digits is a tuple of 2 ints specifying respectively: - The precision: the total number of digits - The scale: the number of digits to the right of the decimal point (PostgresSQL definitions)
type FieldType ¶
type FieldType string
const ( NO_TYPE FieldType = "" BINARY FieldType = "binary" BOOLEAN FieldType = "boolean" CHAR FieldType = "char" DATE FieldType = "date" DATETIME FieldType = "datetime" FLOAT FieldType = "float" HTML FieldType = "html" INTEGER FieldType = "integer" MANY2MANY FieldType = "many2many" MANY2ONE FieldType = "many2one" ONE2MANY FieldType = "one2many" ONE2ONE FieldType = "one2one" REV2ONE FieldType = "rev2one" REFERENCE FieldType = "reference" SELECTION FieldType = "selection" TEXT FieldType = "text" )
type LangDirection ¶
type LangDirection string
const ( LANG_DIRECTION_LTR LangDirection = "ltr" LANG_DIRECTION_RTL LangDirection = "rtl" )