Advertisement
Guest User

Untitled

a guest
May 31st, 2016
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 KB | None | 0 0
  1. Model("User", func() {
  2. Description("This is the User model and describes a User as in any system")
  3. Composition("UserAddon")
  4. Field("id", gorma.UUID, func() {
  5. PrimaryKey()
  6. SQLTag("type:uuid")
  7. Description("This is the ID PK field")
  8. })
  9. Field("email", gorma.String)
  10. })
  11.  
  12.  
  13. type UserStorage interface {
  14. UserAddon // Added by the use of "Composition" in DSL
  15. DB() interface{}
  16. List(ctx context.Context) []User
  17. Get(ctx context.Context, id uuid.UUID) (User, error)
  18. Add(ctx context.Context, user *User) (*User, error)
  19. Update(ctx context.Context, user *User) error
  20. Delete(ctx context.Context, id uuid.UUID) error
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement