Skip to content

Commit

Permalink
feat: add user and post models
Browse files Browse the repository at this point in the history
  • Loading branch information
moul committed Jun 26, 2020
1 parent 5023b12 commit f929619
Show file tree
Hide file tree
Showing 5 changed files with 242 additions and 68 deletions.
14 changes: 14 additions & 0 deletions api/sgtm.proto
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ package sgtm;
option go_package = "moul.io/sgtm/pkg/sgtmpb";

import "google/api/annotations.proto";
import "google/protobuf/timestamp.proto";
import "patch/go.proto";
import "patch/go/field.proto";

Expand All @@ -30,4 +31,17 @@ message Status {

message User {
int64 id = 1 [(go.field.options) = {name: 'ID', tags: 'gorm:"primary_key"'}];
google.protobuf.Timestamp created_at = 2;
google.protobuf.Timestamp updated_at = 3;

string email = 4 [(go.field.options) = {tags: 'gorm:"size:255;not null;index:,unique"'}];
string username = 5 [(go.field.options) = {tags: 'gorm:"size:32;not null;default:\'\'"'}];
string firstname = 6 [(go.field.options) = {tags: 'gorm:"size:255;not null;default:\'\'"'}];
string lastname = 7 [(go.field.options) = {tags: 'gorm:"size:255;not null;default:\'\'"'}];
}

message Post {
int64 id = 1 [(go.field.options) = {name: 'ID', tags: 'gorm:"primary_key"'}];
User user = 2;
int64 user_id = 3 [(go.field.options) = {name: 'UserID'}];
}
2 changes: 1 addition & 1 deletion gen.sum

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions go.mod

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 5 additions & 12 deletions go.sum

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit f929619

Please sign in to comment.