models

package
v0.0.0-...-c35fd87 Latest Latest
Warning

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

Go to latest
Published: Jul 3, 2022 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Question

type Question struct {
	ID             uint           `gorm:"primaryKey" json:"-"`
	Content        string         `json:"-"`
	Choices        pq.StringArray `gorm:"type:text[]"`
	CorrectAnswers pq.StringArray `gorm:"type:text[]"`
	CreatedAt      time.Time      `gorm:"autoCreateTime" json:"-"`
	UpdatedAt      time.Time      `gorm:"autoUpdateTime" json:"-"`
}

type QuestionOrmer

type QuestionOrmer interface {
	GetAllQuestion() (ques []Question, err error)
	GetQuestionByID(id uint) (ques Question, err error)
	InsertQuestion(ques Question) (id uint, err error)
	UpdateQuestion(ques Question) (err error)
	DeleteQuestion(ques Question) (err error)
}

func NewQuestionOrmer

func NewQuestionOrmer(db *gorm.DB) QuestionOrmer

type ScoreBoard

type ScoreBoard struct {
	ID        uint `gorm:"primaryKey" json:"-"`
	UserId    uint
	Score     uint
	CreatedAt time.Time `gorm:"autoCreateTime" json:"-"`
}

type ScoreOrmer

type ScoreOrmer interface {
	GetScoreBoardByUserID(userId uint) (board []ScoreBoard, err error)
	InsertScoreBoard(board ScoreBoard) (id uint, err error)
}

func NewScoreBoardOrmer

func NewScoreBoardOrmer(db *gorm.DB) ScoreOrmer

type Token

type Token struct {
	ID            uint `gorm:"primaryKey" json:"-"`
	Access_token  string
	Refresh_token string
	CreatedAt     time.Time `gorm:"autoCreateTime" json:"-"`
}

type TokenOrmer

type TokenOrmer interface {
	InsertToken(token Token) (id uint, err error)
	DeleteToken(token Token) (err error)
	GetTokenByRefreshToken(refreshToken string) (token Token, err error)
}

func NewTokenOrmer

func NewTokenOrmer(db *gorm.DB) TokenOrmer

type User

type User struct {
	ID        uint      `gorm:"primaryKey" json:"-"`
	Username  string    `gorm:"uniqueIndex" json:"-"`
	Email     string    `gorm:"unique" json:"-"`
	Password  string    `json:"-"`
	IsAdmin   bool      `gorm:"default:false"`
	Bio       string    `json:"-"`
	CreatedAt time.Time `gorm:"autoCreateTime" json:"-"`
	UpdatedAt time.Time `gorm:"autoUpdateTime" json:"-"`
}

type UserOrmer

type UserOrmer interface {
	GetOneByID(id uint) (user User, err error)
	GetOneByUsername(username string) (user User, err error)
	InsertUser(user User) (id uint, err error)
	UpdateUser(user User) (err error)
}

func NewUserOrmer

func NewUserOrmer(db *gorm.DB) UserOrmer

Jump to

Keyboard shortcuts

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