models

package
v0.0.0-...-a1e0d03 Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2020 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateNotification

func CreateNotification(title string, user User, content string, db *gorm.DB)

CreateNotification creates a notification from given parameters

func Migrate

func Migrate(db *gorm.DB)

Migrate the models to the database.

Types

type Answer

type Answer struct {
	gorm.Model
	Type             uint8
	SliderValue      uint
	SliderMax        uint
	SliderMin        uint
	QuestionTempUUID string
	QuestionAnswers  string
	TrueOrFalse      bool
	FullID           uint
}

Answer Data Model

func (*Answer) Serialize

func (answer *Answer) Serialize() common.JSON

Serialize data

type Form

type Form struct {
	gorm.Model
	Title           string
	Description     string
	Questions       []Question
	UniqueID        string
	User            User
	UserID          uint
	ReceiveMessages bool
	CustomMessage   string
}

Form data model

func (*Form) Serialize

func (form *Form) Serialize() common.JSON

Serialize form data

type FormQuestion

type FormQuestion struct {
	Form      common.JSON   `json:"form"`
	Questions []common.JSON `json:"questions"`
}

FormQuestion is used when returning an array with questions and the form

func (*FormQuestion) Serialize

func (fq *FormQuestion) Serialize() common.JSON

Serialize form question data

type Full

type Full struct {
	gorm.Model
	Answers  []Answer
	FormID   uint
	UUID     string
	FormUUID string
}

Full data model

func (*Full) Serialize

func (full *Full) Serialize() common.JSON

Serialize answers data

type Notification

type Notification struct {
	gorm.Model
	Title   string
	UserID  uint
	User    User
	Content string
	UUID    string
	Read    bool
}

Notification model struct

func GetNotificationWithID

func GetNotificationWithID(uuid string, db *gorm.DB) (Notification, bool)

GetNotificationWithID finds a notification with an id and returns the ok status

func (*Notification) Serialize

func (notification *Notification) Serialize() common.JSON

Serialize notification model to JSON format

type Question

type Question struct {
	gorm.Model
	Required      bool
	Question      string
	AnswerType    uint8
	Answers       string
	Step          uint
	Min           uint
	Max           uint
	FormID        uint
	UUID          string
	CustomMessage string
}

Question data

func (*Question) Serialize

func (question *Question) Serialize() common.JSON

Serialize question data

type User

type User struct {
	gorm.Model
	Username string
	Password string
}

User data model

func (*User) Read

func (user *User) Read(m common.JSON)

func (*User) Serialize

func (user *User) Serialize() common.JSON

Serialize user data

Jump to

Keyboard shortcuts

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