account

package
v0.0.0-...-adf365b Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 18, 2016 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var TestIdentity = Identity{
	ID:       uuid.NewV4(),
	FullName: "Test Developer Identity",
}

TestIdentity only creates in memory obj for testing purposes

View Source
var TestUser = User{
	ID:       uuid.NewV4(),
	Email:    "testdeveloper@testalm.io",
	Identity: TestIdentity,
}

TestUser only creates in memory obj for testing purposes

Functions

func UserByEmails

func UserByEmails(emails []string) func(db *gorm.DB) *gorm.DB

UserByEmails is a gorm filter for emails.

func UserFilterByIdentity

func UserFilterByIdentity(identityID uuid.UUID, originaldb *gorm.DB) func(db *gorm.DB) *gorm.DB

UserFilterByIdentity is a gorm filter for a Belongs To relationship.

func UserWithIdentity

func UserWithIdentity() func(db *gorm.DB) *gorm.DB

UserWithIdentity is a gorm filter for preloading the Identity 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) Delete

func (m *GormIdentityRepository) Delete(ctx context.Context, id uuid.UUID) error

Delete removes a single record.

func (*GormIdentityRepository) List

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) Query

func (m *GormIdentityRepository) Query(funcs ...func(*gorm.DB) *gorm.DB) ([]*Identity, error)

Query expose an open ended Query model

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) Delete

func (m *GormUserRepository) Delete(ctx context.Context, id uuid.UUID) error

Delete removes a single record.

func (*GormUserRepository) Load

func (m *GormUserRepository) Load(ctx context.Context, id uuid.UUID) (*User, error)

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) Query

func (m *GormUserRepository) Query(funcs ...func(*gorm.DB) *gorm.DB) ([]*User, error)

Query expose an open ended Query model

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

func (m Identity) ConvertIdentityFromModel() *app.Identity

ConvertIdentityFromModel convert identity from model to app representation

func (Identity) TableName

func (m Identity) TableName() string

TableName overrides the table name settings in Gorm to force a specific table name in the database.

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

func (User) TableName

func (m User) TableName() string

TableName overrides the table name settings in Gorm to force a specific table name in the database.

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL