<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>winebarrel</author_name>
  <author_url>https://blog.hatena.ne.jp/winebarrel/</author_url>
  <blog_title>so what</blog_title>
  <blog_url>https://so-wh.at/</blog_url>
  <categories>
  </categories>
  <description>アプリケーションからDBを使うときに読み込み専用のノードを作ってトランザクションの不要なクエリや重いクエリを読み込み専用のノードに投げるようにすることがよくある。 アプリケーションの全体の情報を保持する構造体があるとして、Writerノード・Readerノードの両方へのコネクションプールを持つ場合、以下のような構造になると思う。 type App struct { WriterDB *sql.DB ReaderDB *sql.DB } ジェネリクスを使わないで*sql.DBの型を分ける ReaderDBしか使わない関数に対してWriterDBを渡されたくないので、WriterDB/Reader…</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fso-wh.at%2Fentry%2F2026%2F01%2F18%2F132941&quot; title=&quot;GolangのジェネリクスでWriterDB/ReaderDBの型を分ける - so what&quot; class=&quot;embed-card embed-blogcard&quot; scrolling=&quot;no&quot; frameborder=&quot;0&quot; style=&quot;display: block; width: 100%; height: 190px; max-width: 500px; margin: 10px 0px;&quot;&gt;&lt;/iframe&gt;</html>
  <image_url></image_url>
  <provider_name>Hatena Blog</provider_name>
  <provider_url>https://hatena.blog</provider_url>
  <published>2026-01-18 13:29:41</published>
  <title>GolangのジェネリクスでWriterDB/ReaderDBの型を分ける</title>
  <type>rich</type>
  <url>https://so-wh.at/entry/2026/01/18/132941</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
