schema := bigquery.Schema{
{
Name: "id",
Required: true,
Description: "ID",
Type: bigquery.StringFieldType,
}, {
Name: "created_at",
Required: true,
Description: "作成された時刻",
Type: bigquery.TimestampFieldType,
DefaultValueExpression: "CURRENT_TIMESTAMP",
},
}
b, err := schema.ToJSONFields()
if err != nil {
panic(err)
}
fmt.Println(string(b))
[
{
"description": "ID",
"mode": "REQUIRED",
"name": "id",
"type": "STRING"
},
{
"defaultValueExpression": "CURRENT_TIMESTAMP",
"description": "作成された時刻",
"mode": "REQUIRED",
"name": "created_at",
"type": "TIMESTAMP"
}
]