Documentation ¶
Index ¶
Constants ¶
View Source
const ( ChangedActionCreated = "CREATED" ChangedActionUpdated = "UPDATED" ChangedActionDeleted = "DELETED" )
Variables ¶
View Source
var ( ErrIdRequired = errors.New("id is required") ErrServerIdRequired = errors.New("server id is required") ErrNameRequired = errors.New("name is required") ErrOneOptionRequired = errors.New("one option is required") ErrOnlyOneOptionAllowed = errors.New("only one option is allowed") ErrServerNotFound = errors.New("server not found") ErrPeerNotFound = errors.New("peer not found") ErrPeerIdAlreadyExists = errors.New("peer id already exists") ErrPeerNameAlreadyInUse = errors.New("peer name already in use") ErrPublicKeyRequired = errors.New("public key is required") ErrPublicKeyAlreadyExists = errors.New("public key already exists") ErrCreatePeerOptionsRequired = errors.New("create peer options are required") ErrUpdatePeerOptionsRequired = errors.New("update peer options are required") ErrUpdatePeerFieldMaskRequired = errors.New("update peer field mask are required") )
Functions ¶
This section is empty.
Types ¶
type ChangedEvent ¶
type CreateOptions ¶
type FindOneOptions ¶
type FindOneOptions struct { IdOption *IdOption ServerIdPublicKeyOption *ServerIdPublicKeyOption }
func (*FindOneOptions) Validate ¶
func (options *FindOneOptions) Validate() error
type FindOptions ¶
type HookAction ¶
type HookAction string
var ( HookActionCreate HookAction = "CREATE" HookActionUpdate HookAction = "UPDATE" HookActionDelete HookAction = "DELETE" )
type Repository ¶
type Repository interface { FindOne(ctx context.Context, options *FindOneOptions) (*Peer, error) FindAll(ctx context.Context, options *FindOptions) ([]*Peer, error) Create(ctx context.Context, peer *Peer) (*Peer, error) Update(ctx context.Context, peer *Peer, fieldMask *UpdateFieldMask) (*Peer, error) Delete(ctx context.Context, peerId string, deleteUserId string) (*Peer, error) }
type ServerIdPublicKeyOption ¶
func (*ServerIdPublicKeyOption) Validate ¶
func (option *ServerIdPublicKeyOption) Validate() error
type Service ¶
type Service interface { FindPeer(ctx context.Context, options *FindOneOptions) (*Peer, error) FindPeers(ctx context.Context, options *FindOptions) ([]*Peer, error) CreatePeer(ctx context.Context, serverId string, options *CreateOptions, userId string) (*Peer, error) UpdatePeer(ctx context.Context, peerId string, options *UpdateOptions, fieldMask *UpdateFieldMask, userId string) (*Peer, error) DeletePeer(ctx context.Context, peerId string, userId string) (*Peer, error) Subscribe(ctx context.Context) (<-chan *ChangedEvent, error) HasSubscribers() bool }
func NewService ¶
func NewService( peerRepository Repository, transactionScoper dbx.TransactionScoper, serverService server.Service, subscription subscription.Subscription, ) Service
type UpdateFieldMask ¶
Click to show internal directories.
Click to hide internal directories.