go-api-boilerplate: github.com/vardius/go-api-boilerplate/cmd/auth/internal/domain/client Index | Files

package client

import "github.com/vardius/go-api-boilerplate/cmd/auth/internal/domain/client"

Package client holds client domain logic

Package client holds client domain logic

Index

Package Files

client.go commands.go events.go json.go repository.go

Variables

var StreamName = fmt.Sprintf("%T", Client{})

StreamName for client domain

func OnCreate Uses

func OnCreate(repository Repository, db *sql.DB) commandbus.CommandHandler

OnCreate creates command handler

func OnRemove Uses

func OnRemove(repository Repository, db *sql.DB) commandbus.CommandHandler

OnRemove creates command handler

type Client Uses

type Client struct {
    // contains filtered or unexported fields
}

Client aggregate root

func FromHistory Uses

func FromHistory(events []domain.Event) Client

FromHistory loads current aggregate root state by applying all events in order

func New Uses

func New() Client

New creates an Client

func (Client) Changes Uses

func (c Client) Changes() []domain.Event

Changes returns all new applied events

func (*Client) Create Uses

func (c *Client) Create(info oauth2.ClientInfo) error

Create alters current client state and append changes to aggregate root

func (Client) ID Uses

func (c Client) ID() uuid.UUID

ID returns aggregate root id

func (*Client) Remove Uses

func (c *Client) Remove() error

Remove alters current client state and append changes to aggregate root

func (Client) Version Uses

func (c Client) Version() int

Version returns current aggregate root version

type Create Uses

type Create struct {
    ClientInfo oauth2.ClientInfo
}

Create command

func (Create) GetName Uses

func (c Create) GetName() string

GetName returns command name

type Remove Uses

type Remove struct {
    ID uuid.UUID `json:"id"`
}

Remove command

func (Remove) GetName Uses

func (c Remove) GetName() string

GetName returns command name

type Repository Uses

type Repository interface {
    Save(ctx context.Context, c Client) error
    Get(id uuid.UUID) Client
}

Repository allows to get/save events from/to event store

type WasCreated Uses

type WasCreated struct {
    ID     uuid.UUID `json:"id"`
    UserID uuid.UUID `json:"userId"`
    Secret string
    Domain string

    Data json.RawMessage `json:"data"`
}

WasCreated event

func (WasCreated) GetType Uses

func (e WasCreated) GetType() string

GetType returns event type

type WasRemoved Uses

type WasRemoved struct {
    ID uuid.UUID `json:"id"`
}

WasRemoved event

func (WasRemoved) GetType Uses

func (e WasRemoved) GetType() string

GetType returns event type

Package client imports 12 packages (graph) and is imported by 3 packages. Updated 2020-08-04. Refresh now. Tools for package owners.