github.com/greenpau/go-identity@v1.1.6/README.md (about) 1 # go-identity 2 3 <a href="https://github.com/greenpau/go-identity/actions/" target="_blank"><img src="https://github.com/greenpau/go-identity/workflows/build/badge.svg?branch=master"></a> 4 <a href="https://pkg.go.dev/github.com/greenpau/go-identity" target="_blank"><img src="https://img.shields.io/badge/godoc-reference-blue.svg"></a> 5 6 ## Overview 7 8 This purpose is a library for the managing user identities for applications. 9 The core of the library is `User` and `Database` data structures. 10 11 The `User` data structure captures the dynamics of user identities in the 12 United States. 13 14 The `Database` data strcuture allows managing these identities. Currently, 15 the `Database` provides a way of managing local users for a web application. 16 17 The key concurrency features of the `Database` are: 18 19 * Only one Go routine is allowed making modifications to users at a time. 20 During that time, the entire database locks. 21 * Keeps user identities in `Users` slice of the `Database` data 22 structure. The elements of the slice are pointers of `User` data structure 23 The slice only grows in size. 24 * Keeps references to user identities in a number hashes for faster lookup. 25 The keys in the hashes are strings and the value is either a single 26 pointer to `User` or a slice of pointers to `User` instances. If a reference 27 keeps unique values, then it is a single pointer, e.g. username. Otherwise, 28 e.g. in the case of being a part of a company, it is a slice. 29 30 The following keys are unique across the database: 31 32 * ID 33 * Username 34 * EmailAddress: a user can have multiple emails, but the emails must 35 be unique across the database.