Documentation ¶
Index ¶
Constants ¶
View Source
const ( ChangedActionCreated = "CREATED" ChangedActionUpdated = "UPDATED" ChangedActionDeleted = "DELETED" )
Variables ¶
View Source
var ( ErrInvalidCredentials = errors.New("invalid credentials") ErrIdRequired = errors.New("id is required") ErrEmailRequired = errors.New("email is required") ErrEmailInvalid = errors.New("email is invalid") ErrOneOptionRequired = errors.New("one option is required") ErrOnlyOneOptionAllowed = errors.New("only one option is allowed") ErrUserNotFound = errors.New("user not found") ErrUserIdAlreadyExists = errors.New("user id already exists") ErrCreateOptionsRequired = errors.New("create options are required") ErrUpdateOptionsRequired = errors.New("update options are required") ErrUpdateFieldMaskRequired = errors.New("update field mask are required") )
Functions ¶
This section is empty.
Types ¶
type ChangedEvent ¶
type CreateOptions ¶
type EmailOption ¶
type EmailOption struct {
Email string
}
func (*EmailOption) Validate ¶
func (option *EmailOption) Validate() error
type FindOneOptions ¶
type FindOneOptions struct { IdOption *IdOption EmailOption *EmailOption }
func (*FindOneOptions) Validate ¶
func (options *FindOneOptions) Validate() error
type FindOptions ¶
type Repository ¶
type Repository interface { FindOne(ctx context.Context, options *FindOneOptions) (*User, error) FindAll(ctx context.Context, options *FindOptions) ([]*User, error) Create(ctx context.Context, user *User) (*User, error) Update(ctx context.Context, user *User, fieldMask *UpdateFieldMask) (*User, error) Delete(ctx context.Context, userId string) (*User, error) }
type Service ¶
type Service interface { Authenticate(ctx context.Context, username string, password string) (*User, error) FindUser(ctx context.Context, options *FindOneOptions) (*User, error) FindUsers(ctx context.Context, options *FindOptions) ([]*User, error) CreateUser(ctx context.Context, options *CreateOptions) (*User, error) UpdateUser(ctx context.Context, userId string, options *UpdateOptions, fieldMask *UpdateFieldMask) (*User, error) DeleteUser(ctx context.Context, userId string) (*User, error) Subscribe(ctx context.Context) (<-chan *ChangedEvent, error) HasSubscribers() bool }
func NewService ¶
func NewService( userRepository Repository, transactionScoper dbx.TransactionScoper, subscription subscription.Subscription, initialEmail string, initialPassword string, ) (Service, error)
type UpdateFieldMask ¶
type UpdateOptions ¶
Click to show internal directories.
Click to hide internal directories.