Skip to content

How load JSON column as an unmarshalled struct? #1058

Answered by stephenafamo
alex-ntousias asked this question in Q&A
Discussion options

You must be logged in to vote

You can do this using in the configuration file. For example:

[[types]]
  [types.match]
    tables = ['users']    # Leave empty to affect all columns with this name
    name = "metadata"    # Name of column to override the type
    nullable = false    # Is it nullable?

  [types.replace]
    type = "customTypes.UserMeta"    # The name of the type to replace with

  [types.imports]
    third_party = ['customTypes "github.com/path/to/custom/types"']    # The package containing your custom type

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@stephenafamo
Comment options

@alex-ntousias
Comment options

Answer selected by alex-ntousias
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants