samedi 27 juin 2015

Basic API in golang antipattern?

Correct me if I'm wrong but for my unterstanding an API is something that allows me to modify and request data through an interface which is what I want to do in golang. For example I have a user interface:

interface IUser {
  GetId() int
  GetName() string
  GetSignupDate() time
  GetPermissions() []IPermission
  Delete()
}

This already looks to me like active record and if I want to create a new user with a new id I would have to use new since go doesn't support static functions as far as I know, which means I would also need a commit function in my interface which makes it even worse for me, what am I doing wrong here?

Aucun commentaire:

Enregistrer un commentaire