Storing Golang JSON into Postgresql

前端 未结 3 1271
深忆病人
深忆病人 2021-02-07 09:57

I want to store a certain struct into my database that has a JSON field within it.

type Comp struct {
    CompId               int64           `db:\"comp_id\" js         


        
3条回答
  •  遥遥无期
    2021-02-07 10:31

    sqlx has a type JSONText in github.com/jmoiron/sqlx/types that will do what you need

    doc for JSONText

提交回复
热议问题