Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

db tag not working. Column name becomes ",size:50" for field Title string db:",size:50" #287

Closed
vinceyuan opened this issue Sep 9, 2015 · 3 comments
Labels

Comments

@vinceyuan
Copy link
Contributor

I am new to gorp and following the QuickStart. I found db tag is not working. The column for field Title becomes ,size:50 instead of Title. The column for field Body becomes article_body,size:1024 instead of article_body. My dev env: OS X Yosemite, golang 1.5.

type Post struct {
    // db tag lets you specify the column name if it differs from the struct field
    Id      int64  `db:"post_id"`
    Created int64
    Title   string `db:",size:50"`               // Column size set to 50
    Body    string `db:"article_body,size:1024"` // Set both column name and size
}
sqlite> .schema posts
CREATE TABLE "posts" ("post_id" integer not null primary key autoincrement, "Created" integer, ",size:50" varchar(255), "article_body,size:1024" varchar(255));
@pierreprinetti
Copy link

The size feature is only available on the development branch. If you feel adventurous, try

import "github.com/go-gorp/gorp"

@vinceyuan
Copy link
Contributor Author

@qrawl I suggest we modify the Quickstart, because new users like me do not know this rule. They just follow the steps in README but find the code does not work as expected. Thanks.

@pierreprinetti
Copy link

You are right. This was meant to be a transitory condition. This should be addressed soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants