Few days ago, I stumbled across a very interesting approach to give permissions (or roles) to users in the system. How do you plan on doing that? I remember, handling this problem in a very different way with user having many to many field. There can be various approaches to this. Say, you have to give multiple permissions to user logged into your system. permissions Let me share an interesting approach using the bitwise operator. So the idea is to have each bit in a binary sequence denote a permission, similar to how chmod number permission works. Let look at the code below in golang. main ( ) ( isAdmin = << isDev isDevOps ) { fmt.Printf( , isAdmin) fmt.Printf( , isDev) fmt.Printf( , isDevOps) role = isDev | isAdmin fmt.Printf( , role & isDev == isDev) fmt.Printf( , role & isAdmin == isAdmin) fmt.Printf( , role & isDevOps == isDevOps) } package import "fmt" const 1 iota func main () "Admin: %b\n" "Dev: %b\n" "Devops: %b\n" var byte "IsDev? %v\n" "IsAdmin? %v\n" "IsDevOps? %v\n" The output of the snippet above is: Admin: Dev: Devops: IsDev? IsAdmin? IsDevOps? 1 10 100 true true false Let see how this works. We initialise 3 constants , and with binary values 001, 010 and 100 respectively. Then we define a variable of type byte and initialise it to a operation on isDev and isAdmin. So after OR operation, has the value of 011. In this way we can store multiple permissions in a single byte. isAdmin isDev isDevOps role bitwise OR role To verify the permissions, we can just do an operation and check the value with the permission. Example, AND role: ( Admin and Dev ) Checking dev( ) role, (role) & (dev) -> which is value dev. Implying that, role contains dev permission. 011 for 010 in 011 010 010 for The idea isn't limited to the permissions only. There could be many use cases. But I personally loved this approach.