AddQuestion add question
(ctx context.Context, question *entity.Question)
| 64 | |
| 65 | // AddQuestion add question |
| 66 | func (qr *questionRepo) AddQuestion(ctx context.Context, question *entity.Question) (err error) { |
| 67 | question.ID, err = qr.uniqueIDRepo.GenUniqueIDStr(ctx, question.TableName()) |
| 68 | if err != nil { |
| 69 | return errors.InternalServer(reason.DatabaseError).WithError(err).WithStack() |
| 70 | } |
| 71 | _, err = qr.data.DB.Context(ctx).Insert(question) |
| 72 | if err != nil { |
| 73 | return errors.InternalServer(reason.DatabaseError).WithError(err).WithStack() |
| 74 | } |
| 75 | if handler.GetEnableShortID(ctx) { |
| 76 | question.ID = uid.EnShortID(question.ID) |
| 77 | } |
| 78 | return |
| 79 | } |
| 80 | |
| 81 | // RemoveQuestion delete question |
| 82 | func (qr *questionRepo) RemoveQuestion(ctx context.Context, id string) (err error) { |
nothing calls this directly
no test coverage detected