models

package
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 28, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MongodbEscapeString

func MongodbEscapeString(value string) string

MongodbEscapeString escapes the control characters used by mongodb commands TODO at the moment we only check for '$' char. We may need a deeper discussion about this

func MysqlRealEscapeString

func MysqlRealEscapeString(value string) string

MysqlRealEscapeString escapes the control characters used by sql commands

func Sanitize

func Sanitize(cfg *config.Sanitize, toSanitize string) string

Sanitize sanitizes the input string to prevent html, mysql and nosql (mongodb only) injection attacks

Types

type Feedback

type Feedback struct {
	IsPageUseful      *bool  `json:"is_page_useful"         validate:"required"`
	IsGeneralFeedback *bool  `json:"is_general_feedback"    validate:"required"`
	OnsURL            string `json:"ons_url,omitempty"      validate:"omitempty,ons_url"`
	Feedback          string `json:"feedback,omitempty"`
	Name              string `json:"name,omitempty"`
	EmailAddress      string `json:"email_address,omitempty" validate:"omitempty,email"`
}

func (*Feedback) Sanitize

func (f *Feedback) Sanitize(cfg *config.Sanitize)

Sanitize mutates all the strings in Feedback to prevent HTML, SQL and NoSQL injections, according to the provided config

func (*Feedback) Validate

func (f *Feedback) Validate(cfg *config.Config) error

Validate checks that the Feedback struct complies with the validation tags

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL