12345678910111213141516171819202122232425262728293031323334 |
- package dao
- import (
- "github.com/sirupsen/logrus"
- "youngee_b_api/app/entity"
- )
- type SecExampleDao struct{}
- func (d SecExampleDao) DeleteSecExampleBySelectionId(selectionId string) error {
- err := Db.Where("selection_id = ?", selectionId).Delete(entity.SecExample{}).Error
- if err != nil {
- return err
- }
- return nil
- }
- func (d SecExampleDao) CreateSecExample(secExample entity.SecExample) error {
- err := Db.Create(&secExample).Error
- if err != nil {
- return err
- }
- return nil
- }
- func (d SecExampleDao) GetSelectionExampleInfo(selectionId string) ([]*entity.SecExample, error) {
- var selectionExampleInfos []*entity.SecExample
- err := Db.Model(entity.SecExample{}).Where("selection_id = ?", selectionId).Find(&selectionExampleInfos).Error
- if err != nil {
- logrus.Errorf("[GetSelectionExampleInfo] error query, err:%+v", err)
- return nil, err
- }
- return selectionExampleInfos, nil
- }
|