Documentation ¶
Index ¶
- Constants
- Variables
- func InitTables(db *egorm.Component) error
- type AnswerElement
- type GORMQuestionDAO
- func (g *GORMQuestionDAO) Count(ctx context.Context) (int64, error)
- func (g *GORMQuestionDAO) Create(ctx context.Context, q Question, eles []AnswerElement) (int64, error)
- func (g *GORMQuestionDAO) GetByID(ctx context.Context, id int64) (Question, []AnswerElement, error)
- func (g *GORMQuestionDAO) GetPubByID(ctx context.Context, qid int64) (PublishQuestion, []PublishAnswerElement, error)
- func (g *GORMQuestionDAO) GetPubByIDs(ctx context.Context, qids []int64) ([]PublishQuestion, error)
- func (g *GORMQuestionDAO) List(ctx context.Context, offset int, limit int) ([]Question, error)
- func (g *GORMQuestionDAO) PubCount(ctx context.Context) (int64, error)
- func (g *GORMQuestionDAO) PubList(ctx context.Context, offset int, limit int) ([]PublishQuestion, error)
- func (g *GORMQuestionDAO) Sync(ctx context.Context, que Question, eles []AnswerElement) (int64, error)
- func (g *GORMQuestionDAO) Update(ctx context.Context, q Question, eles []AnswerElement) error
- type GORMQuestionSetDAO
- func (g *GORMQuestionSetDAO) Count(ctx context.Context) (int64, error)
- func (g *GORMQuestionSetDAO) Create(ctx context.Context, qs QuestionSet) (int64, error)
- func (g *GORMQuestionSetDAO) GetByID(ctx context.Context, id int64) (QuestionSet, error)
- func (g *GORMQuestionSetDAO) GetQuestionsByID(ctx context.Context, id int64) ([]Question, error)
- func (g *GORMQuestionSetDAO) List(ctx context.Context, offset, limit int) ([]QuestionSet, error)
- func (g *GORMQuestionSetDAO) UpdateNonZero(ctx context.Context, set QuestionSet) error
- func (g *GORMQuestionSetDAO) UpdateQuestionsByID(ctx context.Context, id int64, qids []int64) error
- type PublishAnswerElement
- type PublishQuestion
- type Question
- type QuestionDAO
- type QuestionSet
- type QuestionSetDAO
- type QuestionSetQuestion
Constants ¶
View Source
const ( AnswerElementTypeUnknown = iota AnswerElementTypeAnalysis AnswerElementTypeBasic AnswerElementTypeIntermedia AnswerElementTypeAdvanced )
Variables ¶
View Source
var (
ErrInvalidQuestionID = errors.New("问题ID非法")
)
Functions ¶
func InitTables ¶
Types ¶
type AnswerElement ¶
type AnswerElement struct { Id int64 `gorm:"primaryKey,autoIncrement"` // 问题 ID Qid int64 `gorm:"uniqueIndex:qid_type"` Type uint8 `gorm:"uniqueIndex:qid_type"` // 回答内容 Content string // 关键字,辅助记忆,提取重点 Keywords string // 速记,口诀 Shorthand string // 亮点 Highlight string // 引导点 Guidance string Ctime int64 Utime int64 }
AnswerElement 回答,对于一个问题来说,回答分成好几个部分 这个就是代表一个部分 理论上来说应该要考虑引入一个叫做 Answer 的表 但是个人觉得目前没有必要
type GORMQuestionDAO ¶
type GORMQuestionDAO struct {
// contains filtered or unexported fields
}
func (*GORMQuestionDAO) Create ¶
func (g *GORMQuestionDAO) Create(ctx context.Context, q Question, eles []AnswerElement) (int64, error)
func (*GORMQuestionDAO) GetByID ¶
func (g *GORMQuestionDAO) GetByID(ctx context.Context, id int64) (Question, []AnswerElement, error)
func (*GORMQuestionDAO) GetPubByID ¶
func (g *GORMQuestionDAO) GetPubByID(ctx context.Context, qid int64) (PublishQuestion, []PublishAnswerElement, error)
func (*GORMQuestionDAO) GetPubByIDs ¶ added in v0.0.2
func (g *GORMQuestionDAO) GetPubByIDs(ctx context.Context, qids []int64) ([]PublishQuestion, error)
func (*GORMQuestionDAO) PubCount ¶
func (g *GORMQuestionDAO) PubCount(ctx context.Context) (int64, error)
func (*GORMQuestionDAO) PubList ¶
func (g *GORMQuestionDAO) PubList(ctx context.Context, offset int, limit int) ([]PublishQuestion, error)
func (*GORMQuestionDAO) Sync ¶
func (g *GORMQuestionDAO) Sync(ctx context.Context, que Question, eles []AnswerElement) (int64, error)
func (*GORMQuestionDAO) Update ¶
func (g *GORMQuestionDAO) Update(ctx context.Context, q Question, eles []AnswerElement) error
type GORMQuestionSetDAO ¶
type GORMQuestionSetDAO struct {
// contains filtered or unexported fields
}
func (*GORMQuestionSetDAO) Count ¶
func (g *GORMQuestionSetDAO) Count(ctx context.Context) (int64, error)
func (*GORMQuestionSetDAO) Create ¶
func (g *GORMQuestionSetDAO) Create(ctx context.Context, qs QuestionSet) (int64, error)
func (*GORMQuestionSetDAO) GetByID ¶
func (g *GORMQuestionSetDAO) GetByID(ctx context.Context, id int64) (QuestionSet, error)
func (*GORMQuestionSetDAO) GetQuestionsByID ¶
func (*GORMQuestionSetDAO) List ¶
func (g *GORMQuestionSetDAO) List(ctx context.Context, offset, limit int) ([]QuestionSet, error)
func (*GORMQuestionSetDAO) UpdateNonZero ¶
func (g *GORMQuestionSetDAO) UpdateNonZero(ctx context.Context, set QuestionSet) error
func (*GORMQuestionSetDAO) UpdateQuestionsByID ¶
type PublishAnswerElement ¶
type PublishAnswerElement AnswerElement
type PublishQuestion ¶
type PublishQuestion Question
type QuestionDAO ¶
type QuestionDAO interface { Update(ctx context.Context, q Question, eles []AnswerElement) error Create(ctx context.Context, q Question, eles []AnswerElement) (int64, error) GetByID(ctx context.Context, id int64) (Question, []AnswerElement, error) List(ctx context.Context, offset int, limit int) ([]Question, error) Count(ctx context.Context) (int64, error) Sync(ctx context.Context, que Question, eles []AnswerElement) (int64, error) // 线上库 API PubList(ctx context.Context, offset int, limit int) ([]PublishQuestion, error) PubCount(ctx context.Context) (int64, error) GetPubByID(ctx context.Context, qid int64) (PublishQuestion, []PublishAnswerElement, error) GetPubByIDs(ctx context.Context, qids []int64) ([]PublishQuestion, error) }
func NewGORMQuestionDAO ¶
func NewGORMQuestionDAO(db *egorm.Component) QuestionDAO
type QuestionSet ¶
type QuestionSet struct { Id int64 `gorm:"primaryKey,autoIncrement"` // 所有者 Uid int64 `gorm:"index"` // 题集标题 Title string // 题集描述 Description string Ctime int64 Utime int64 `gorm:"index"` }
QuestionSet 题集 属于个人
type QuestionSetDAO ¶
type QuestionSetDAO interface { Create(ctx context.Context, qs QuestionSet) (int64, error) GetByID(ctx context.Context, id int64) (QuestionSet, error) GetQuestionsByID(ctx context.Context, id int64) ([]Question, error) UpdateQuestionsByID(ctx context.Context, id int64, qids []int64) error Count(ctx context.Context) (int64, error) List(ctx context.Context, offset, limit int) ([]QuestionSet, error) UpdateNonZero(ctx context.Context, set QuestionSet) error }
func NewGORMQuestionSetDAO ¶
func NewGORMQuestionSetDAO(db *egorm.Component) QuestionSetDAO
Click to show internal directories.
Click to hide internal directories.