Files
ristek-task-be/internal/db/sqlc/repository/models.go
bagas ffab4f22ad
Docker Build and Push / Build and Push Docker Image (push) Successful in 13m18s
feat: add form response submition endpoint and forms filtering
2026-02-22 14:13:59 +07:00

119 lines
2.4 KiB
Go

// Code generated by sqlc. DO NOT EDIT.
// versions:
// sqlc v1.30.0
package repository
import (
"database/sql/driver"
"fmt"
"github.com/google/uuid"
"github.com/jackc/pgx/v5/pgtype"
)
type QuestionType string
const (
QuestionTypeShortText QuestionType = "short_text"
QuestionTypeLongText QuestionType = "long_text"
QuestionTypeMultipleChoice QuestionType = "multiple_choice"
QuestionTypeCheckbox QuestionType = "checkbox"
QuestionTypeDropdown QuestionType = "dropdown"
QuestionTypeDate QuestionType = "date"
QuestionTypeRating QuestionType = "rating"
)
func (e *QuestionType) Scan(src interface{}) error {
switch s := src.(type) {
case []byte:
*e = QuestionType(s)
case string:
*e = QuestionType(s)
default:
return fmt.Errorf("unsupported scan type for QuestionType: %T", src)
}
return nil
}
type NullQuestionType struct {
QuestionType QuestionType
Valid bool // Valid is true if QuestionType is not NULL
}
// Scan implements the Scanner interface.
func (ns *NullQuestionType) Scan(value interface{}) error {
if value == nil {
ns.QuestionType, ns.Valid = "", false
return nil
}
ns.Valid = true
return ns.QuestionType.Scan(value)
}
// Value implements the driver Valuer interface.
func (ns NullQuestionType) Value() (driver.Value, error) {
if !ns.Valid {
return nil, nil
}
return string(ns.QuestionType), nil
}
type Form struct {
ID uuid.UUID
UserID uuid.UUID
Title string
Description pgtype.Text
ResponseCount int32
CreatedAt pgtype.Timestamptz
UpdatedAt pgtype.Timestamptz
}
type FormResponse struct {
ID uuid.UUID
FormID uuid.UUID
UserID *uuid.UUID
SubmittedAt pgtype.Timestamptz
}
type Question struct {
ID uuid.UUID
FormID uuid.UUID
Type QuestionType
Title string
Required bool
Position int32
}
type QuestionOption struct {
ID int32
FormID uuid.UUID
QuestionID uuid.UUID
Label string
Position int32
}
type RefreshToken struct {
ID uuid.UUID
UserID uuid.UUID
Token string
ExpiresAt pgtype.Timestamptz
CreatedAt pgtype.Timestamptz
}
type ResponseAnswer struct {
ID int64
ResponseID uuid.UUID
QuestionID uuid.UUID
FormID uuid.UUID
AnswerText pgtype.Text
}
type User struct {
ID uuid.UUID
Email string
PasswordHash string
CreatedAt pgtype.Timestamptz
UpdatedAt pgtype.Timestamptz
}