Skip to content

Instantly share code, notes, and snippets.

View victorsteven's full-sized avatar

Victor Steven victorsteven

View GitHub Profile
package main
import (
"fmt"
"github.com/99designs/gqlgen/graphql/handler"
"github.com/99designs/gqlgen/graphql/playground"
"github.com/joho/godotenv"
_ "github.com/lib/pq"
"log"
"multi-choice/app/domain/repository/answer"
package db
import (
"github.com/jinzhu/gorm"
"log"
"multi-choice/app/models"
"os"
)
func OpenDB(database string) *gorm.DB {
package persistence
import (
"errors"
"github.com/jinzhu/gorm"
"multi-choice/app/domain/repository/question_option"
"multi-choice/app/models"
)
type optService struct {
package persistence
import (
"errors"
"github.com/jinzhu/gorm"
"multi-choice/app/domain/repository/answer"
"multi-choice/app/models"
)
type ansService struct {
package persistence
import (
"errors"
"github.com/jinzhu/gorm"
"multi-choice/app/domain/repository/question"
"multi-choice/app/models"
"strings"
)
package question_option
import (
"multi-choice/app/models"
)
type OptService interface {
CreateQuestionOption(question *models.QuestionOption) (*models.QuestionOption, error)
UpdateQuestionOption(question *models.QuestionOption) (*models.QuestionOption, error)
DeleteQuestionOption(id string) error
package answer
import (
"multi-choice/app/models"
)
type AnsService interface {
CreateAnswer(answer *models.Answer) (*models.Answer, error)
UpdateAnswer(answer *models.Answer) (*models.Answer, error)
DeleteAnswer(id string) error
package question
import (
"multi-choice/app/models"
)
type QuesService interface {
CreateQuestion(question *models.Question) (*models.Question, error)
UpdateQuestion(question *models.Question) (*models.Question, error)
DeleteQuestion(id string) error
package interfaces
import (
"multi-choice/app/domain/repository/answer"
"multi-choice/app/domain/repository/question"
"multi-choice/app/domain/repository/question_option"
)
// This file will not be regenerated automatically.
//
package interfaces
// This file will be automatically regenerated based on the schema, any resolver implementations
// will be copied through when generating and any unknown code will be moved to the end.
import (
"context"
"log"
"multi-choice/app/models"
"multi-choice/helpers"