Documentation ¶
Index ¶
- Variables
- func UserByEmails(emails []string) func(db *gorm.DB) *gorm.DB
- func UserFilterByIdentity(identityID uuid.UUID, originaldb *gorm.DB) func(db *gorm.DB) *gorm.DB
- func UserWithIdentity() func(db *gorm.DB) *gorm.DB
- type GormIdentityRepository
- func (m *GormIdentityRepository) Create(ctx context.Context, model *Identity) error
- func (m *GormIdentityRepository) Delete(ctx context.Context, id uuid.UUID) error
- func (m *GormIdentityRepository) List(ctx context.Context) (*app.IdentityArray, error)
- func (m *GormIdentityRepository) Load(ctx context.Context, id uuid.UUID) (*Identity, error)
- func (m *GormIdentityRepository) Query(funcs ...func(*gorm.DB) *gorm.DB) ([]*Identity, error)
- func (m *GormIdentityRepository) Save(ctx context.Context, model *Identity) error
- func (m *GormIdentityRepository) TableName() string
- type GormUserRepository
- func (m *GormUserRepository) Create(ctx context.Context, u *User) error
- func (m *GormUserRepository) Delete(ctx context.Context, id uuid.UUID) error
- func (m *GormUserRepository) Load(ctx context.Context, id uuid.UUID) (*User, error)
- func (m *GormUserRepository) Query(funcs ...func(*gorm.DB) *gorm.DB) ([]*User, error)
- func (m *GormUserRepository) Save(ctx context.Context, model *User) error
- func (m *GormUserRepository) TableName() string
- type Identity
- type IdentityRepository
- type User
- type UserRepository
Constants ¶
This section is empty.
Variables ¶
var TestIdentity = Identity{ ID: uuid.NewV4(), FullName: "Test Developer Identity", }
TestIdentity only creates in memory obj for testing purposes
var TestUser = User{ ID: uuid.NewV4(), Email: "testdeveloper@testalm.io", Identity: TestIdentity, }
TestUser only creates in memory obj for testing purposes
Functions ¶
func UserByEmails ¶
UserByEmails is a gorm filter for emails.
func UserFilterByIdentity ¶
UserFilterByIdentity is a gorm filter for a Belongs To relationship.
Types ¶
type GormIdentityRepository ¶
type GormIdentityRepository struct {
// contains filtered or unexported fields
}
GormIdentityRepository is the implementation of the storage interface for Identity.
func NewIdentityRepository ¶
func NewIdentityRepository(db *gorm.DB) *GormIdentityRepository
NewIdentityRepository creates a new storage type.
func (*GormIdentityRepository) Create ¶
func (m *GormIdentityRepository) Create(ctx context.Context, model *Identity) error
Create creates a new record.
func (*GormIdentityRepository) List ¶
func (m *GormIdentityRepository) List(ctx context.Context) (*app.IdentityArray, error)
List return all user identities
func (*GormIdentityRepository) Load ¶
Load returns a single Identity as a Database Model This is more for use internally, and probably not what you want in your controllers
func (*GormIdentityRepository) Save ¶
func (m *GormIdentityRepository) Save(ctx context.Context, model *Identity) error
Save modifies a single record.
func (*GormIdentityRepository) TableName ¶
func (m *GormIdentityRepository) TableName() string
TableName overrides the table name settings in Gorm to force a specific table name in the database.
type GormUserRepository ¶
type GormUserRepository struct {
// contains filtered or unexported fields
}
GormUserRepository is the implementation of the storage interface for User.
func (*GormUserRepository) Create ¶
func (m *GormUserRepository) Create(ctx context.Context, u *User) error
Create creates a new record.
func (*GormUserRepository) Load ¶
Load returns a single User as a Database Model This is more for use internally, and probably not what you want in your controllers
func (*GormUserRepository) Save ¶
func (m *GormUserRepository) Save(ctx context.Context, model *User) error
Save modifies a single record
func (*GormUserRepository) TableName ¶
func (m *GormUserRepository) TableName() string
TableName overrides the table name settings in Gorm to force a specific table name in the database.
type Identity ¶
type Identity struct { gormsupport.Lifecycle ID uuid.UUID `sql:"type:uuid default uuid_generate_v4()" gorm:"primary_key"` // This is the ID PK field Emails []User // has many Users FullName string // The fullname of the Identity ImageURL string // The image URL for this Identity }
Identity ddenDescribes a unique Person with the ALM
func (Identity) ConvertIdentityFromModel ¶
ConvertIdentityFromModel convert identity from model to app representation
type IdentityRepository ¶
type IdentityRepository interface { Load(ctx context.Context, id uuid.UUID) (*Identity, error) Create(ctx context.Context, identity *Identity) error Save(ctx context.Context, identity *Identity) error Delete(ctx context.Context, id uuid.UUID) error Query(funcs ...func(*gorm.DB) *gorm.DB) ([]*Identity, error) }
IdentityRepository represents the storage interface.
type User ¶
type User struct { gormsupport.Lifecycle ID uuid.UUID `sql:"type:uuid default uuid_generate_v4()" gorm:"primary_key"` // This is the ID PK field Email string `sql:"unique_index"` // This is the unique email field IdentityID uuid.UUID `sql:"type:uuid"` // Belongs To Identity Identity Identity }
User describes a User(single email) in any system
type UserRepository ¶
type UserRepository interface { Load(ctx context.Context, ID uuid.UUID) (*User, error) Create(ctx context.Context, u *User) error Save(ctx context.Context, u *User) error Delete(ctx context.Context, ID uuid.UUID) error Query(funcs ...func(*gorm.DB) *gorm.DB) ([]*User, error) }
UserRepository represents the storage interface.
func NewUserRepository ¶
func NewUserRepository(db *gorm.DB) UserRepository
NewUserRepository creates a new storage type.