Documentation
¶
Index ¶
- Constants
- func CreateInitialCategories(db *gorm.DB) error
- func CreateWeight(ctx context.Context, in *qpb.CreateQuestionRequest, db *gorm.DB, answer Answer) ([5]byte, error)
- func Decrypt(cryptoText string) map[string]string
- func GetEmail(authToken string) string
- func GetLevel(category *Category, db *gorm.DB) int32
- func GetPersonalityScore(user User, answer Answer, option int32, db *gorm.DB) (float32, error)
- func GetWeightRange(category *Category, db *gorm.DB) string
- func RegisterAnswer(answer Answer, user User, in *pb.GetQuestionRequest, db *gorm.DB) (int32, error)
- func SetupDatabase(db *gorm.DB) error
- func WeightRange(questions []Question) string
- type Answer
- type Category
- type Question
- type User
- type UsersAnswer
- type Weight
Constants ¶
View Source
const Key = "fkzfgk0FY2CaYJhyXbshnPJaRrFtCwfj"
Variables ¶
This section is empty.
Functions ¶
func CreateInitialCategories ¶
CreateInitialCategories ...
func CreateWeight ¶
func CreateWeight(ctx context.Context, in *qpb.CreateQuestionRequest, db *gorm.DB, answer Answer) ([5]byte, error)
CreateWeight ...
func GetPersonalityScore ¶
GetPersonalityScore ...
func GetWeightRange ¶
GetWeightRange ...
func RegisterAnswer ¶
func RegisterAnswer(answer Answer, user User, in *pb.GetQuestionRequest, db *gorm.DB) (int32, error)
RegisterAnswer ...
func SetupDatabase ¶
SetupDatabase - Creates the tables in the database
Types ¶
type Answer ¶
type Answer struct { gorm.Model UserID uint QuestionID uint Weights []byte `gorm:"type=bytea"` Categories []byte `gorm:"type=bytea"` Option1 string `json:"Option1"` Option2 string `json:"Option2"` Option3 string `json:"Option3"` Option4 string `json:"Option4"` Option5 string `json:"Option5"` UsersAnswer UsersAnswer }
Answer is a gorm model
type Category ¶
type Category struct { gorm.Model Questions []Question Name string Parent uint Level int32 Approved bool Option int32 `gorm:"-"` // ignore this field }
Category is a gorm model
type Question ¶
type Question struct { gorm.Model Title string Body string Answer Answer Weight Weight Approved bool CategoryID uint UserID uint }
Question is a gorm model
func (Question) CreateInDB ¶
func (question Question) CreateInDB(ctx context.Context, in *qpb.CreateQuestionRequest, db *gorm.DB) (*qpb.CreateQuestionResponse, error)
CreateInDB question and return response
type User ¶
type User struct { gorm.Model Email string `validate:"required"` Questions []Question Answers []Answer UsersAnswer UsersAnswer Score float32 }
User is a gorm model
func (User) ApproveEntries ¶
func (user User) ApproveEntries(ctx context.Context, in *upb.ApproveEntriesRequest, db *gorm.DB) (*upb.ApproveEntriesResponse, error)
ApproveEntries ...
func (User) GetEntries ¶
func (user User) GetEntries(ctx context.Context, in *upb.GetEntriesRequest, db *gorm.DB) (*upb.GetEntriesResponse, error)
GetEntries ...
type UsersAnswer ¶
UsersAnswer is a gorm model
Click to show internal directories.
Click to hide internal directories.