8000 Documentation: CreateTable is misleading in "Basic Example" · Issue #73 · eaigner/hood · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Documentation: CreateTable is misleading in "Basic Example" #73
Open
@hahnicity

Description

@hahnicity

You show in your "Basic Example":

func main() {
    // Open a DB connection, use New() alternatively for unregistered dialects
    hd, err := hood.Open("postgres", "user=hood dbname=hood_test sslmode=disable")
    if err != nil {
        panic(err)
    }

    // Create a table
    type Fruit struct {
        Id    hood.Id
        Name  string `validate:"presence"`
        Color string
    } 

    err = hd.CreateTable(&Fruit{})

However when I try to replicate this flow myself I receive an error saying

    panic: CreateTable can only be invoked inside a transaction

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0