feat: upload
This commit is contained in:
@@ -122,3 +122,19 @@ func (svc *Service) SetDefault(ctx context.Context, id int64) error {
|
||||
// Commit transaction
|
||||
return tx.Commit()
|
||||
}
|
||||
|
||||
// GetDefault
|
||||
func (svc *Service) GetDefault(ctx context.Context) (*model.Storages, error) {
|
||||
_, span := otel.Start(ctx, "storages.service.GetDefault")
|
||||
defer span.End()
|
||||
|
||||
tbl := table.Storages
|
||||
stmt := tbl.SELECT(tbl.AllColumns).WHERE(tbl.IsDefault.EQ(Bool(true)))
|
||||
span.SetAttributes(semconv.DBStatementKey.String(stmt.DebugSql()))
|
||||
|
||||
var storage model.Storages
|
||||
if err := stmt.QueryContext(ctx, svc.db, &storage); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &storage, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user