Bridgeパターン_katagiri.md
参照: https://refactoring.guru/ja/design-patterns/bridge
構造的パターンの一つ 巨大クラス、密接に関連するクラスの集まりを抽象と実装に分解し、それらを独立に変更できるようにする。
Bridgeパターン_katagiri.md
参照: https://refactoring.guru/ja/design-patterns/bridge
構造的パターンの一つ 巨大クラス、密接に関連するクラスの集まりを抽象と実装に分解し、それらを独立に変更できるようにする。
| --- sqlite3 inner joinとleft joinの例 | |
| -- table Hogeがあったら削除 | |
| drop table if exists Hoge; | |
| -- table Hogeがなかったら作る | |
| create table if not exists Hoge ( | |
| name varchar(255) not null, | |
| age int not null |
| type UseSWR<T> = typeof useSWR< | |
| T, | |
| unknown, | |
| Partial<PublicConfiguration<T, unknown, BareFetcher<T>>> | undefined | |
| > | |
| const getHoge: UseSWR<Hoge> = useSWR |
pcregrepは複数行のgrepとして使える。
typeormのDataSouce周りを調べてみましたのでまとめます。
DataSourceの初期化はDataSourceインスタンスのinitializeメソッドを呼び出して行う。 DataSourceの生成でDBの設定をする。
| import glob | |
| import os | |
| import re | |
| paths = glob.glob("./*.*.json") | |
| for path in paths: | |
| file = os.path.basename(path) | |
| pattern = r".*\.(.*\.json)" |
| import os | |
| path = "./hogehoge.txt" | |
| distpath = "./hogehoge2.txt" | |
| os.rename(path, distpath) |
| import re | |
| import glob | |
| txt = "hogehoge[abccbbss, bccc, [caaa, caaa], abb,]" | |
| def matchlastComma(txt): | |
| pattern = r"(.*)," | |
| m = re.findall(pattern, txt, flags=(re.MULTILINE | re.DOTALL)) | |
| if len(m) == 0: |
| import os | |
| path = "./hogehoge.txt" | |
| with open(path, mode='w') as f: | |
| f.write("a") | |
| with open(path) as f: | |
| t = f.read() | |
| print(t) |
| import glob | |
| files = glob.glob("./*") | |
| for file in files: | |
| print(file) |