Skip to content

Implement db.Model.BelongsTo(anotherModel) #22

@drborges

Description

@drborges

Checks whether a model's key uses another model's key as its parent.

type Account struct {
   Name string `db:"id"` 
}

type Post struct {
  Title string
}

// ommit models initialization

account := &Account{}
err := datastore.Load(account)

post := Post{"A new awesome post"}
// Sets account as the post's parent
post.BelongsTo(account)

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