graph

package
v0.0.0-...-4ecb97e Latest Latest
Warning

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

Go to latest
Published: Jan 22, 2022 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

Functions

func JobToDBModel

func JobToDBModel(j Job) db.Job

func NewExecutableSchema

func NewExecutableSchema(cfg Config) graphql.ExecutableSchema

NewExecutableSchema creates an ExecutableSchema from the ResolverRoot interface.

func TaskToDBModel

func TaskToDBModel(m Task) db.Task

func UserToDBModel

func UserToDBModel(u User) db.User

Types

type ComplexityRoot

type ComplexityRoot struct {
	Error struct {
		Code    func(childComplexity int) int
		Message func(childComplexity int) int
	}

	Job struct {
		Dataset     func(childComplexity int) int
		DockerImage func(childComplexity int) int
		Env         func(childComplexity int) int
	}

	Mutation struct {
		CreateTask func(childComplexity int, input NewTask) int
		CreateUser func(childComplexity int, input NewUser) int
	}

	Query struct {
		ListTasks func(childComplexity int) int
		Login     func(childComplexity int, id string, pwd string) int
	}

	Task struct {
		CreatedAt func(childComplexity int) int
		EndedAt   func(childComplexity int) int
		ID        func(childComplexity int) int
		Job       func(childComplexity int) int
		StartedAt func(childComplexity int) int
		Status    func(childComplexity int) int
		UserID    func(childComplexity int) int
	}

	Token struct {
		Token    func(childComplexity int) int
		UserID   func(childComplexity int) int
		Username func(childComplexity int) int
	}

	User struct {
		Admin     func(childComplexity int) int
		CreatedAt func(childComplexity int) int
		Email     func(childComplexity int) int
		ID        func(childComplexity int) int
	}
}

type Config

type Config struct {
	Resolvers  ResolverRoot
	Directives DirectiveRoot
	Complexity ComplexityRoot
}

type DirectiveRoot

type DirectiveRoot struct {
}

type Error

type Error struct {
	Code    int    `json:"code"`
	Message string `json:"message"`
}

func (Error) IsLoginRes

func (Error) IsLoginRes()

type Job

type Job struct {
	DockerImage string   `json:"docker_image"`
	Dataset     *string  `json:"dataset"`
	Env         []string `json:"env"`
}

func JobFromDBModel

func JobFromDBModel(j db.Job) *Job

func (Job) Ptr

func (j Job) Ptr() *Job

type LoginRes

type LoginRes interface {
	IsLoginRes()
}

type MutationResolver

type MutationResolver interface {
	CreateUser(ctx context.Context, input NewUser) (*User, error)
	CreateTask(ctx context.Context, input NewTask) (*Task, error)
}

type NewTask

type NewTask struct {
	DockerImage string   `json:"docker_image"`
	Dataset     *string  `json:"dataset"`
	Env         []string `json:"env"`
}

type NewUser

type NewUser struct {
	Email string `json:"email"`
}

type QueryResolver

type QueryResolver interface {
	ListTasks(ctx context.Context) ([]*Task, error)
	Login(ctx context.Context, id string, pwd string) (LoginRes, error)
}

type Resolver

type Resolver struct {
	Log     logger.Logger
	Dbal    db.Dbal
	Config  conf.Configuration
	ApiHost string
	ApiPort string
	Auth    auth.Auth
}

func (*Resolver) Mutation

func (r *Resolver) Mutation() MutationResolver

Mutation returns MutationResolver implementation.

func (*Resolver) Query

func (r *Resolver) Query() QueryResolver

Query returns QueryResolver implementation.

type ResolverRoot

type ResolverRoot interface {
	Mutation() MutationResolver
	Query() QueryResolver
}

type Status

type Status string
const (
	StatusStatusless Status = "STATUSLESS"
	StatusFailed     Status = "FAILED"
	StatusNotStarted Status = "NOT_STARTED"
	StatusRunning    Status = "RUNNING"
	StatusEnded      Status = "ENDED"
	StatusCanceled   Status = "CANCELED"
)

func (Status) IsValid

func (e Status) IsValid() bool

func (Status) MarshalGQL

func (e Status) MarshalGQL(w io.Writer)

func (Status) String

func (e Status) String() string

func (*Status) UnmarshalGQL

func (e *Status) UnmarshalGQL(v interface{}) error

type Task

type Task struct {
	ID        string    `json:"id"`
	UserID    string    `json:"user_id"`
	CreatedAt time.Time `json:"created_at"`
	StartedAt time.Time `json:"started_at"`
	EndedAt   time.Time `json:"ended_at"`
	Status    Status    `json:"status"`
	Job       *Job      `json:"job"`
}

func TaskFromDBModel

func TaskFromDBModel(m db.Task) Task

func (*Task) MarshalLogObject

func (t *Task) MarshalLogObject(encoder zapcore.ObjectEncoder) error

func (Task) Ptr

func (t Task) Ptr() *Task

type Tasks

type Tasks []*Task

func (Tasks) MarshalLogArray

func (t Tasks) MarshalLogArray(encoder zapcore.ArrayEncoder) error

type Token

type Token struct {
	Username string `json:"username"`
	Token    string `json:"token"`
	UserID   string `json:"userId"`
}

func (Token) IsLoginRes

func (Token) IsLoginRes()

type User

type User struct {
	ID        string    `json:"id"`
	Admin     bool      `json:"admin"`
	Email     string    `json:"email"`
	CreatedAt time.Time `json:"created_at"`
}

func UserFromDBModel

func UserFromDBModel(u db.User) User

func (User) Ptr

func (u User) Ptr() *User

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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