model

package
v0.0.63 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2019 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ValidateParams added in v0.0.13

func ValidateParams(params map[string]interface{}) error

ValidateParams checks string parameters passed to it and returns error in case of blank values.

func ValidateString added in v0.0.63

func ValidateString(value string, constraint StringType, regex ...string) (bool, error)

ValidateString checks whether the given string conforms to the given constraint. Valid constraints are AlphaNumeric, AlphaNumericAndHyphen, Email, URL and RegEx. If the given constraint is RegEx, then the 3rd parameter should contain a valid regular expression.

Types

type Base

type Base struct {
	ID        uuid.UUID  `gorm:"type:varchar(36);primary_key;"`
	CreatedAt time.Time  `gorm:"column:createdOn"`
	UpdatedAt time.Time  `gorm:"column:modifiedOn"`
	DeletedAt *time.Time `sql:"index" gorm:"column:deletedOn"`
}

Base contains common columns for all tables.

type StringType added in v0.0.63

type StringType string

StringType represents the type of the string

const (
	//AlphaNumeric represents string containing only alphabets and numbers
	AlphaNumeric StringType = "AlphaNumeric"
	//AlphaNumericAndHyphen represents string containing alphabets, numbers and hyphen
	AlphaNumericAndHyphen StringType = "AlphaNumericAndHyphen"
	//Email represents string containing email address
	Email StringType = "Email"
	//URL represents string containing URL
	URL StringType = "URL"
	//RegEx represents string containing regular expression
	RegEx StringType = "RegEx"
)

type TenantBase added in v0.0.5

type TenantBase struct {
	ID        uuid.UUID  `gorm:"type:varchar(36);primary_key;"`
	TenantID  uuid.UUID  `gorm:"type:varchar(36);column:tenantId;"`
	CreatedAt time.Time  `gorm:"column:createdOn"`
	UpdatedAt time.Time  `gorm:"column:modifiedOn"`
	DeletedAt *time.Time `sql:"index" gorm:"column:deletedOn"`
}

TenantBase contains common columns for all tables that are tenant specific.

Jump to

Keyboard shortcuts

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