mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Rename Id to ID for annotation models (#62886)
* Rename Id to ID for annotation models * Add xorm tags * Rename Id to ID for API key models * Add xorm tags
This commit is contained in:
@@ -22,12 +22,12 @@ func (repo *fakeAnnotationsRepo) Delete(_ context.Context, params *annotations.D
|
||||
repo.mtx.Lock()
|
||||
defer repo.mtx.Unlock()
|
||||
|
||||
if params.Id != 0 {
|
||||
delete(repo.annotations, params.Id)
|
||||
if params.ID != 0 {
|
||||
delete(repo.annotations, params.ID)
|
||||
} else {
|
||||
for _, v := range repo.annotations {
|
||||
if params.DashboardId == v.DashboardId && params.PanelId == v.PanelId {
|
||||
delete(repo.annotations, v.Id)
|
||||
if params.DashboardID == v.DashboardID && params.PanelID == v.PanelID {
|
||||
delete(repo.annotations, v.ID)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -39,10 +39,10 @@ func (repo *fakeAnnotationsRepo) Save(ctx context.Context, item *annotations.Ite
|
||||
repo.mtx.Lock()
|
||||
defer repo.mtx.Unlock()
|
||||
|
||||
if item.Id == 0 {
|
||||
item.Id = int64(len(repo.annotations) + 1)
|
||||
if item.ID == 0 {
|
||||
item.ID = int64(len(repo.annotations) + 1)
|
||||
}
|
||||
repo.annotations[item.Id] = *item
|
||||
repo.annotations[item.ID] = *item
|
||||
|
||||
return nil
|
||||
}
|
||||
@@ -52,10 +52,10 @@ func (repo *fakeAnnotationsRepo) SaveMany(ctx context.Context, items []annotatio
|
||||
defer repo.mtx.Unlock()
|
||||
|
||||
for _, i := range items {
|
||||
if i.Id == 0 {
|
||||
i.Id = int64(len(repo.annotations) + 1)
|
||||
if i.ID == 0 {
|
||||
i.ID = int64(len(repo.annotations) + 1)
|
||||
}
|
||||
repo.annotations[i.Id] = i
|
||||
repo.annotations[i.ID] = i
|
||||
}
|
||||
|
||||
return nil
|
||||
@@ -69,10 +69,10 @@ func (repo *fakeAnnotationsRepo) Find(_ context.Context, query *annotations.Item
|
||||
repo.mtx.Lock()
|
||||
defer repo.mtx.Unlock()
|
||||
|
||||
if annotation, has := repo.annotations[query.AnnotationId]; has {
|
||||
return []*annotations.ItemDTO{{Id: annotation.Id, DashboardId: annotation.DashboardId}}, nil
|
||||
if annotation, has := repo.annotations[query.AnnotationID]; has {
|
||||
return []*annotations.ItemDTO{{ID: annotation.ID, DashboardID: annotation.DashboardID}}, nil
|
||||
}
|
||||
annotations := []*annotations.ItemDTO{{Id: 1, DashboardId: 0}}
|
||||
annotations := []*annotations.ItemDTO{{ID: 1, DashboardID: 0}}
|
||||
return annotations, nil
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user