Chore: Rename Id to ID in alerting models (#62777)

* Chore: Rename Id to ID in alerting models

* Add xorm tags for datasource

* Add xorm tag for uid
This commit is contained in:
idafurjes
2023-02-02 17:22:43 +01:00
committed by GitHub
parent 48a374f50b
commit 23c27cffb3
88 changed files with 698 additions and 698 deletions

View File

@@ -74,11 +74,11 @@ type Service struct {
func DataSourceModel(orgId int64) *datasources.DataSource {
return &datasources.DataSource{
Id: DatasourceID,
Uid: DatasourceUID,
ID: DatasourceID,
UID: DatasourceUID,
Name: DatasourceName,
Type: "grafana",
OrgId: orgId,
OrgID: orgId,
JsonData: simplejson.New(),
SecureJsonData: make(map[string][]byte),
}

View File

@@ -79,9 +79,9 @@ func generateRequest(ctx context.Context, ds *datasources.DataSource, decryptedJ
}
instanceSettings := &backend.DataSourceInstanceSettings{
ID: ds.Id,
ID: ds.ID,
Name: ds.Name,
URL: ds.Url,
URL: ds.URL,
Database: ds.Database,
User: ds.User,
BasicAuthEnabled: ds.BasicAuth,
@@ -89,7 +89,7 @@ func generateRequest(ctx context.Context, ds *datasources.DataSource, decryptedJ
JSONData: jsonDataBytes,
DecryptedSecureJSONData: decryptedJsonData,
Updated: ds.Updated,
UID: ds.Uid,
UID: ds.UID,
}
if query.Headers == nil {
@@ -98,7 +98,7 @@ func generateRequest(ctx context.Context, ds *datasources.DataSource, decryptedJ
req := &backend.QueryDataRequest{
PluginContext: backend.PluginContext{
OrgID: ds.OrgId,
OrgID: ds.OrgID,
PluginID: ds.Type,
User: adapters.BackendUserFromSignedInUser(query.User),
DataSourceInstanceSettings: instanceSettings,

View File

@@ -40,12 +40,12 @@ func TestHandleRequest(t *testing.T) {
s := ProvideService(client, nil, dsService)
ds := &datasources.DataSource{Id: 12, Type: "unregisteredType", JsonData: simplejson.New()}
ds := &datasources.DataSource{ID: 12, Type: "unregisteredType", JsonData: simplejson.New()}
req := legacydata.DataQuery{
TimeRange: &legacydata.DataTimeRange{},
Queries: []legacydata.DataSubQuery{
{RefID: "A", DataSource: &datasources.DataSource{Id: 1, Type: "test"}, Model: simplejson.New()},
{RefID: "B", DataSource: &datasources.DataSource{Id: 1, Type: "test"}, Model: simplejson.New()},
{RefID: "A", DataSource: &datasources.DataSource{ID: 1, Type: "test"}, Model: simplejson.New()},
{RefID: "B", DataSource: &datasources.DataSource{ID: 1, Type: "test"}, Model: simplejson.New()},
},
}
res, err := s.HandleRequest(context.Background(), ds, req)