Skip to content

Instantly share code, notes, and snippets.

@slonka
Created March 28, 2023 16:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save slonka/b1a4ab178ad765dc952b923435db893d to your computer and use it in GitHub Desktop.
Save slonka/b1a4ab178ad765dc952b923435db893d to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<!-- saved from url=(0073)file:///private/var/folders/ts/xg_0vxrd0yj9n7pckrc0fq5r0000gn/T/diff.html -->
<html lang="en"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Pretty Diff</title>
<style>
body {
text-align: center;
}
#wrapper {
display: inline-block;
margin-top: 1em;
min-width: 800px;
text-align: left;
}
h2 {
background: #fafafa;
background: -moz-linear-gradient(#fafafa, #eaeaea);
background: -webkit-linear-gradient(#fafafa, #eaeaea);
-ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorstr='#fafafa',endColorstr='#eaeaea')";
border: 1px solid #d8d8d8;
border-bottom: 0;
color: #555;
font: 14px sans-serif;
overflow: hidden;
padding: 10px 6px;
text-shadow: 0 1px 0 white;
margin: 0;
}
.copy {
float: right;
}
.file-diff {
border: 1px solid #d8d8d8;
margin-bottom: 1em;
overflow: auto;
padding: 0.5em 0;
}
.file-diff > div {
width: 100%;
}
pre {
margin: 0;
font-family: "Bitstream Vera Sans Mono", Courier, monospace;
font-size: 12px;
line-height: 1.4em;
text-indent: 0.5em;
}
.file {
color: #aaa;
}
.delete {
background-color: #fdd;
}
.insert {
background-color: #dfd;
}
.info {
color: #a0b;
}
</style>
</head>
<body>
<div id="wrapper">
<h2>pkg/plugins/resources/postgres/pq_plugin.go<button class="copy" onclick="navigator.clipboard.writeText(&quot;pkg/plugins/resources/postgres/pq_plugin.go&quot;)">copy path</button></h2><div class="file-diff"><div><pre class="file">diff --git a/pkg/plugins/resources/postgres/pq_plugin.go b/pkg/plugins/resources/postgres/pgx_plugin.go</pre>
<pre class="file">index 233b88860..075485afb 100644</pre>
<pre class="delete">--- a/pkg/plugins/resources/postgres/pq_plugin.go</pre>
<pre class="insert">+++ b/pkg/plugins/resources/postgres/pgx_plugin.go</pre>
<pre class="info">@@ -12,15 +12,15 @@ import (</pre>
<pre class="context"> postgres_events "github.com/kumahq/kuma/pkg/plugins/resources/postgres/events"</pre>
<pre class="context"> )</pre>
<pre class="context"> </pre>
<pre class="delete">-var _ core_plugins.ResourceStorePlugin = &amp;pqPlugin{}</pre>
<pre class="insert">+var _ core_plugins.ResourceStorePlugin = &amp;pgxPlugin{}</pre>
<pre class="context"> </pre>
<pre class="delete">-type pqPlugin struct{}</pre>
<pre class="insert">+type pgxPlugin struct{}</pre>
<pre class="context"> </pre>
<pre class="context"> func init() {</pre>
<pre class="delete">- core_plugins.Register(core_plugins.Postgres, &amp;pqPlugin{})</pre>
<pre class="insert">+ core_plugins.Register(core_plugins.Pgx, &amp;pgxPlugin{})</pre>
<pre class="context"> }</pre>
<pre class="context"> </pre>
<pre class="delete">-func (p *pqPlugin) NewResourceStore(pc core_plugins.PluginContext, config core_plugins.PluginConfig) (core_store.ResourceStore, error) {</pre>
<pre class="insert">+func (p *pgxPlugin) NewResourceStore(pc core_plugins.PluginContext, config core_plugins.PluginConfig) (core_store.ResourceStore, error) {</pre>
<pre class="context"> cfg, ok := config.(*postgres.PostgresStoreConfig)</pre>
<pre class="context"> if !ok {</pre>
<pre class="context"> return nil, errors.New("invalid type of the config. Passed config should be a PostgresStoreConfig")</pre>
<pre class="info">@@ -32,10 +32,10 @@ func (p *pqPlugin) NewResourceStore(pc core_plugins.PluginContext, config core_p</pre>
<pre class="context"> if !migrated {</pre>
<pre class="context"> return nil, errors.New(`database is not migrated. Run "kuma-cp migrate up" to update database to the newest schema`)</pre>
<pre class="context"> }</pre>
<pre class="delete">- return NewPqStore(pc.Metrics(), *cfg)</pre>
<pre class="insert">+ return NewPgxStore(pc.Metrics(), *cfg)</pre>
<pre class="context"> }</pre>
<pre class="context"> </pre>
<pre class="delete">-func (p *pqPlugin) Migrate(pc core_plugins.PluginContext, config core_plugins.PluginConfig) (core_plugins.DbVersion, error) {</pre>
<pre class="insert">+func (p *pgxPlugin) Migrate(pc core_plugins.PluginContext, config core_plugins.PluginConfig) (core_plugins.DbVersion, error) {</pre>
<pre class="context"> cfg, ok := config.(*postgres.PostgresStoreConfig)</pre>
<pre class="context"> if !ok {</pre>
<pre class="context"> return 0, errors.New("invalid type of the config. Passed config should be a PostgresStoreConfig")</pre>
<pre class="info">@@ -43,7 +43,7 @@ func (p *pqPlugin) Migrate(pc core_plugins.PluginContext, config core_plugins.Pl</pre>
<pre class="context"> return MigrateDb(*cfg)</pre>
<pre class="context"> }</pre>
<pre class="context"> </pre>
<pre class="delete">-func (p *pqPlugin) EventListener(pc core_plugins.PluginContext, out events.Emitter) error {</pre>
<pre class="insert">+func (p *pgxPlugin) EventListener(pc core_plugins.PluginContext, out events.Emitter) error {</pre>
<pre class="context"> postgresListener := postgres_events.NewListener(*pc.Config().Store.Postgres, out)</pre>
<pre class="context"> return pc.ComponentManager().Add(component.NewResilientComponent(core.Log.WithName("postgres-event-listener-component"), postgresListener))</pre>
<pre class="context"> }</pre></div></div>
</div>
</body></html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment