MCPcopy Index your code
hub / github.com/apache/answer / AddQuestion

Method AddQuestion

internal/repo/question/question_repo.go:66–79  ·  view source on GitHub ↗

AddQuestion add question

(ctx context.Context, question *entity.Question)

Source from the content-addressed store, hash-verified

64
65// AddQuestion add question
66func (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
82func (qr *questionRepo) RemoveQuestion(ctx context.Context, id string) (err error) {

Callers

nothing calls this directly

Calls 5

GetEnableShortIDFunction · 0.92
EnShortIDFunction · 0.92
InsertMethod · 0.80
GenUniqueIDStrMethod · 0.65
TableNameMethod · 0.45

Tested by

no test coverage detected