Skip to content

Instantly share code, notes, and snippets.

@Mo3g4u
Mo3g4u / struct-tag.go
Created August 22, 2022 04:24
タグを使った構造体へのデータの書き込み
package main
// タグを使った構造体へのデータの書き込み
import (
"fmt"
"reflect"
"strconv"
)
@Mo3g4u
Mo3g4u / confidential.go
Created August 20, 2022 07:14
機密情報を扱うフィールドを定義して出力書式をカスタマイズする
package main
import (
"encoding/json"
"fmt"
)
type ConfidentialCustomer struct {
CustomerID int64
CreditCard CreditCard
@Mo3g4u
Mo3g4u / functional-option.go
Created August 19, 2022 06:48
Functional Optionパターンを使ったオプション引数
package main
import "fmt"
// Functional Optionパターンを使ったオプション引数
type Portion int
const (
Regular Portion = iota
@Mo3g4u
Mo3g4u / builder-option.go
Created August 19, 2022 05:14
ビルダーを利用したオプション引数
package main
// ビルダーを利用したオプション引数
import "fmt"
type Portion int
const (
Regular Portion = iota
@Mo3g4u
Mo3g4u / struct-option.go
Created August 19, 2022 05:06
構造体を利用したオプション引数
package main
// 構造体を利用したオプション引数
import "fmt"
type Portion int
const (
Regular Portion = iota
@Mo3g4u
Mo3g4u / bimap.go
Created December 3, 2021 06:58
bimap
package bimap
import (
"sync"
"github.com/artis-inc/axis-shared/log"
)
// 方向の定義
const (
@Mo3g4u
Mo3g4u / encode.go
Last active December 3, 2021 00:44
go encode sample
package main
import (
"encoding/base64"
"fmt"
"io"
"io/ioutil"
"log"
"strings"
)
@Mo3g4u
Mo3g4u / decode.go
Last active December 3, 2021 00:45
go decode sample
package main
import (
"context"
"encoding/base64"
"io"
"os"
"strings"
"golang.org/x/sync/errgroup"
CREATE TABLE t1 (jdoc JSON);
INSERT INTO t1 VALUES('{"name": "aaa1", "type": 1, "available": true, "start": "2021-06-25T00:00:00+09:00"}');
INSERT INTO t1 VALUES('{"name": "aaa2", "type": 1, "available": false, "start": "2021-06-26T00:00:00+09:00"}');
INSERT INTO t1 VALUES('{"name": "aaa3", "type": 1, "available": false, "start": "2021-06-27T00:00:00+09:00"}');
INSERT INTO t1 VALUES('{"name": "aaa4", "type": 1, "available": true, "start": "2021-06-28T00:00:00+09:00"}');
INSERT INTO t1 VALUES('{"name": "aaa1", "type": 2, "available": true, "start": "2021-06-25T00:00:00+09:00"}');
INSERT INTO t1 VALUES('{"name": "aaa2", "type": 2, "available": false, "start": "2021-06-24T00:00:00+09:00"}');
INSERT INTO t1 VALUES('{"name": "aaa3", "type": 2, "available": false, "start": "2021-06-23T00:00:00+09:00"}');
INSERT INTO t1 VALUES('{"name": "aaa4", "type": 2, "available": true, "start": "2021-06-22T00:00:00+09:00"}');
## クラス
- 水
- プロパティ
- 量
- 温度
- メソッド
- 温度変更
- 電気ポット
- プロパティ
- 水