示例#1
0
文件: card.go 项目: hairqles/scholar
// NewHandler Returns with a Handler and initialize the card.
func NewHandler() (*Handler, error) {
	con := app.GetDBConnection()

	if err := con.Ping(); err != nil {
		return nil, err
	}

	h := &Handler{con}

	return h, nil
}
示例#2
0
func init() {
	var err error

	con := app.GetDBConnection()
	if err != nil {
		log.Fatal(err)
	}

	ch := card.GetHandler()
	rh := result.GetHandler()
	h := SpacedRepetitionLearner{con, rh, ch}

	err = h.createSRTable()
	if err != nil {
		log.Fatal(err)
	}

	srLearner = &h
}