Skip to content

Commit

Permalink
docs(all): Update models to use value receivers
Browse files Browse the repository at this point in the history
  • Loading branch information
bartventer committed Jun 2, 2024
1 parent 1766db1 commit a70380a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Example (PostgreSQL):
}
// Implement the gorm.Tabler interface
func (t *Tenant) TableName() string {return "public.tenants"} // Note the public. prefix
func (Tenant) TableName() string {return "public.tenants"} // Note the public. prefix
// Book is a tenant specific model
type Book struct {
Expand All @@ -29,10 +29,10 @@ Example (PostgreSQL):
}
// Implement the gorm.Tabler interface
func (b *Book) TableName() string {return "books"} // Note the lack of prefix
func (Book) TableName() string {return "books"} // Note the lack of prefix
// Implement the TenantTabler interface
func (b *Book) IsTenantTable() bool {return true} // This classifies the model as a tenant specific model
func (Book) IsTenantTable() bool {return true} // This classifies the model as a tenant specific model
func main(){
// Open a connection to the database
Expand Down
6 changes: 3 additions & 3 deletions drivers/postgres/postgres.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Example:
}
// Implement the gorm.Tabler interface
func (t *Tenant) TableName() string {return "public.tenants"} // Note the public. prefix
func (Tenant) TableName() string {return "public.tenants"} // Note the public. prefix
// Book is a tenant specific model
type Book struct {
Expand All @@ -29,10 +29,10 @@ Example:
}
// Implement the gorm.Tabler interface
func (b *Book) TableName() string {return "books"} // Note the lack of prefix
func (Book) TableName() string {return "books"} // Note the lack of prefix
// Implement the TenantTabler interface
func (b *Book) IsTenantTable() bool {return true} // This classifies the model as a tenant specific model
func (Book) IsTenantTable() bool {return true} // This classifies the model as a tenant specific model
func main(){
// Open a connection to the database
Expand Down

0 comments on commit a70380a

Please sign in to comment.