feat(repository): Add method for create status by observer
This commit is contained in:
@@ -1,12 +1,14 @@
|
||||
package repository
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"git.ostiwe.com/ostiwe-com/status/model"
|
||||
"git.ostiwe.com/ostiwe-com/status/modules/db"
|
||||
)
|
||||
|
||||
type Status interface {
|
||||
Add(status model.Status) error
|
||||
Add(ctx context.Context, status model.Status) error
|
||||
}
|
||||
|
||||
type status struct {
|
||||
@@ -19,6 +21,6 @@ func NewStatusRepository() Status {
|
||||
}
|
||||
}
|
||||
|
||||
func (s status) Add(status model.Status) error {
|
||||
return s.db.Create(&status).Error
|
||||
func (s status) Add(ctx context.Context, status model.Status) error {
|
||||
return s.db.WithContext(ctx).Create(&status).Error
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user