domain

package
v0.0.0-...-2f4d8a3 Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const Lang2Len = 2
View Source
const StudyMaxLevel = 10
View Source
const StudyMinLevel = 0

Variables

View Source
var ErrPluginError = errors.New("plugin error")
View Source
var ErrorTypeClient = "client"
View Source
var PrivilegeRead = userD.RBACAction("read")
View Source
var PrivilegeRemove = userD.RBACAction("remove")
View Source
var PrivilegeUpdate = userD.RBACAction("update")
View Source
var WorkbookObjectPrefix = "workbook_"

Functions

func NewWorkbookObject

func NewWorkbookObject(workbookID WorkbookID) userD.RBACObject

func NewWorkbookReader

func NewWorkbookReader(workbookID WorkbookID) userD.RBACRole

func NewWorkbookWriter

func NewWorkbookWriter(workbookID WorkbookID) userD.RBACRole

Types

type AudioID

type AudioID uint

type AudioModel

type AudioModel interface {
	GetID() uint
	GetLang2() Lang2
	GetText() string
	GetContent() string
}

func NewAudioModel

func NewAudioModel(id uint, lang2 Lang2, text, content string) (AudioModel, error)

type ErrorType

type ErrorType string

type GuestModel

type GuestModel interface {
	userD.AppUserModel
	IsGuestModel() bool
}

func NewGuestModel

func NewGuestModel(appUser userD.AppUserModel) (GuestModel, error)

type Lang2

type Lang2 interface {
	String() string
}
var (
	Lang2EN      Lang2
	Lang2ES      Lang2
	Lang2JA      Lang2
	Lang2KO      Lang2
	Lang2Unknown Lang2
)

func NewLang2

func NewLang2(lang string) (Lang2, error)

type PluginError

type PluginError struct {
	ErrorType     ErrorType
	ErrorCode     string
	ErrorMessages []string
	OrgError      error
}

func NewPluginError

func NewPluginError(errorType ErrorType, errorCode string, errorMessages []string, err error) *PluginError

func (*PluginError) Error

func (e *PluginError) Error() string

type ProblemAddParameter

type ProblemAddParameter interface {
	GetWorkbookID() WorkbookID
	GetProperties() map[string]string
	GetStringProperty(name string) (string, error)
	GetIntProperty(name string) (int, error)
}

func NewProblemAddParameter

func NewProblemAddParameter(workbookID WorkbookID, properties map[string]string) (ProblemAddParameter, error)

type ProblemID

type ProblemID uint

type ProblemIDsCondition

type ProblemIDsCondition interface {
	GetWorkbookID() WorkbookID
	GetIDs() []ProblemID
}

func NewProblemIDsCondition

func NewProblemIDsCondition(workbookID WorkbookID, ids []ProblemID) (ProblemIDsCondition, error)

type ProblemModel

type ProblemModel interface {
	userD.Model
	GetNumber() int
	GetProblemType() ProblemTypeName
	GetProperties(ctx context.Context) map[string]interface{}
}

func NewProblemModel

func NewProblemModel(model userD.Model, number int, problemType ProblemTypeName, properties map[string]interface{}) (ProblemModel, error)

type ProblemPropertyUpdateParameter

type ProblemPropertyUpdateParameter interface {
	GetKey() string
	GetValue() string
}

func NewProblemPropertyUpdateParameter

func NewProblemPropertyUpdateParameter(key, value string) (ProblemPropertyUpdateParameter, error)

type ProblemSearchCondition

type ProblemSearchCondition interface {
	GetWorkbookID() WorkbookID
	GetPageNo() int
	GetPageSize() int
	GetKeyword() string
}

func NewProblemSearchCondition

func NewProblemSearchCondition(workbookID WorkbookID, pageNo, pageSize int, keyword string) (ProblemSearchCondition, error)

type ProblemSearchResult

type ProblemSearchResult interface {
	GetTotalCount() int
	GetResults() []ProblemModel
}

func NewProblemSearchResult

func NewProblemSearchResult(totalCount int, results []ProblemModel) (ProblemSearchResult, error)

type ProblemSelectParameter1

type ProblemSelectParameter1 interface {
	GetWorkbookID() WorkbookID
	GetProblemID() ProblemID
}

func NewProblemSelectParameter1

func NewProblemSelectParameter1(WorkbookID WorkbookID, problemID ProblemID) (ProblemSelectParameter1, error)

type ProblemSelectParameter2

type ProblemSelectParameter2 interface {
	GetWorkbookID() WorkbookID
	GetProblemID() ProblemID
	GetVersion() int
}

func NewProblemSelectParameter2

func NewProblemSelectParameter2(WorkbookID WorkbookID, problemID ProblemID, version int) (ProblemSelectParameter2, error)

type ProblemType

type ProblemType interface {
	GetID() uint
	GetName() ProblemTypeName
}

func NewProblemType

func NewProblemType(id uint, name string) (ProblemType, error)

type ProblemTypeName

type ProblemTypeName string

type ProblemUpdateParameter

type ProblemUpdateParameter interface {
	GetProperties() map[string]string
	GetStringProperty(name string) (string, error)
	GetIntProperty(name string) (int, error)
}

func NewProblemUpdateParameter

func NewProblemUpdateParameter(properties map[string]string) (ProblemUpdateParameter, error)

type StatHistory

type StatHistory struct {
	Results []StatHistoryResult
}

type StatHistoryResult

type StatHistoryResult struct {
	Date     time.Time
	Mastered int
	Answered int
}

type StatModel

type StatModel interface {
	GetUserID() userD.AppUserID
	GetHistory() StatHistory
}

func NewStatModel

func NewStatModel(userID userD.AppUserID, history StatHistory) (StatModel, error)

type StudentModel

type StudentModel interface {
	userD.AppUserModel
	GetAppUserID() userD.AppUserID
	IsStudentModel() bool
}

func NewStudentModel

func NewStudentModel(appUserModel userD.AppUserModel) (StudentModel, error)

type StudyRecord

type StudyRecord struct {
	Level          int
	ResultPrev1    bool
	Mastered       bool
	LastAnsweredAt *time.Time
}

type StudyRecordWithProblemID

type StudyRecordWithProblemID struct {
	ProblemID   ProblemID
	StudyRecord StudyRecord
}

type StudyResultParameter

type StudyResultParameter struct {
	Result bool
}

type StudyType

type StudyType interface {
	GetID() uint
	GetName() StudyTypeName
}

func NewStudyType

func NewStudyType(id uint, name string) (StudyType, error)

type StudyTypeName

type StudyTypeName string

type SystemStudentModel

type SystemStudentModel interface {
	userD.AppUserModel
	IsSystemStudentModel() bool
}

func NewSystemStudentModel

func NewSystemStudentModel(appUser userD.AppUserModel) (SystemStudentModel, error)

type WorkbookAddParameter

type WorkbookAddParameter interface {
	GetProblemType() ProblemTypeName
	GetName() string
	GetLang2() Lang2
	GetQuestionText() string
	GetProperties() map[string]string
}

func NewWorkbookAddParameter

func NewWorkbookAddParameter(problemType ProblemTypeName, name string, lang2 Lang2, questionText string, properties map[string]string) (WorkbookAddParameter, error)

type WorkbookID

type WorkbookID uint

type WorkbookModel

type WorkbookModel interface {
	userD.Model
	GetWorkbookID() WorkbookID
	GetSpaceID() userD.SpaceID
	GetOwnerID() userD.AppUserID
	GetName() string
	GetLang2() Lang2
	GetProblemType() ProblemTypeName
	GetQuestionText() string
	GetProperties() map[string]string
	HasPrivilege(privilege userD.RBACAction) bool
}

func NewWorkbookModel

func NewWorkbookModel(model userD.Model, spaceID userD.SpaceID, ownerID userD.AppUserID, privileges userD.Privileges, name string, lang2 Lang2, problemType ProblemTypeName, questsionText string, properties map[string]string) (WorkbookModel, error)

type WorkbookSearchCondition

type WorkbookSearchCondition interface {
	GetPageNo() int
	GetPageSize() int
	GetSpaceIDs() []userD.SpaceID
}

func NewWorkbookSearchCondition

func NewWorkbookSearchCondition(pageNo, pageSize int, spaceIDs []userD.SpaceID) (WorkbookSearchCondition, error)

type WorkbookSearchResult

type WorkbookSearchResult interface {
	GetTotalCount() int
	GetResults() []WorkbookModel
}

func NewWorkbookSearchResult

func NewWorkbookSearchResult(totalCount int, results []WorkbookModel) (WorkbookSearchResult, error)

type WorkbookUpdateParameter

type WorkbookUpdateParameter interface {
	GetName() string
	GetQuestionText() string
}

func NewWorkbookUpdateParameter

func NewWorkbookUpdateParameter(name, questionText string) (WorkbookUpdateParameter, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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