pkg

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

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

Go to latest
Published: Nov 23, 2016 License: MIT Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client interface {
	Connect() Session
}

Client creates a connection to the services.

type Course

type Course struct {
	ID              int    `json:"id"`
	Name            string `json:"name"`
	Description     string `json:"description"`
	Instructor      string `json:"instructor"`
	InstructorEmail string `json:"instructor_email"`
}

type CourseStorage

type CourseStorage interface {
	Course(int) (*Course, error)
	AddCourse(*Course) error
	RemoveCourse(*Course) error
	Validator
}

type Session

type Session interface {
	SetAuthToken(token string)
	StudentStorage() StudentStorage
	CourseStorage() CourseStorage
}

Session represents authenticable connection to the services.

type Student

type Student struct {
	UID           int       `json:"uid"`
	Username      string    `json:"username"`
	Password      string    `json:"password"`
	FullName      string    `json:"full_name"`
	Email         string    `json:"email"`
	HomeDirectory string    `json:"home_directory"`
	Courses       []*Course `json:"courses"`
}

type StudentStorage

type StudentStorage interface {
	Student(id int) (*Student, error)
	Exists(*Student) (bool, error)
	AddStudent(*Student) error
	RemoveStudent(*Student) error
	Enroll(*Student, *Course) error
	List() ([]*Student, error)
}

type UserManager

type UserManager interface {
	CheckUsername(*Student) error
	AddUser(*Student) error
	RemoveUser(*Student) error
}

type Validator

type Validator interface {
	Validate(token string) (*Course, error)
	Encode(id int) (string, error)
}

Validator represents a service for authenticating courses by validating the token

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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