Documentation ¶
Index ¶
- type Option
- type Store
- func (s *Store) CreateAuthentication(ctx context.Context, r *storageauth.CreateAuthenticationRequest) (string, *rpcauth.Authentication, error)
- func (s *Store) DeleteAuthentications(ctx context.Context, req *storageauth.DeleteAuthenticationsRequest) (err error)
- func (s *Store) ExpireAuthenticationByID(ctx context.Context, id string, expireAt *timestamppb.Timestamp) (err error)
- func (s *Store) GetAuthenticationByClientToken(ctx context.Context, clientToken string) (*rpcauth.Authentication, error)
- func (s *Store) GetAuthenticationByID(ctx context.Context, id string) (*rpcauth.Authentication, error)
- func (s *Store) ListAuthentications(ctx context.Context, ...) (set storage.ResultSet[*rpcauth.Authentication], err error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Option ¶
type Option func(*Store)
Option is a type which configures a *Store
func WithIDGeneratorFunc ¶
WithIDGeneratorFunc overrides the stores ID generator function used to generate new random ID strings, when creating new instances of Authentications. The default is a string containing a valid UUID (V4).
func WithNowFunc ¶
func WithNowFunc(fn func() *timestamppb.Timestamp) Option
WithNowFunc overrides the stores now() function used to obtain a protobuf timestamp representative of the current time of evaluation.
func WithTokenGeneratorFunc ¶
WithTokenGeneratorFunc overrides the stores token generator function used to generate new random token strings as client tokens, when creating new instances of Authentication. The default is a pseudo-random string of bytes base64 encoded.
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store is the persistent storage layer for Authentications backed by SQL based relational database systems.
func NewStore ¶
func NewStore(driver storagesql.Driver, builder sq.StatementBuilderType, logger *zap.Logger, opts ...Option) *Store
NewStore constructs and configures a new instance of *Store. Queries are issued to the database via the provided statement builder.
func (*Store) CreateAuthentication ¶
func (s *Store) CreateAuthentication(ctx context.Context, r *storageauth.CreateAuthenticationRequest) (string, *rpcauth.Authentication, error)
CreateAuthentication creates and persists an instance of an Authentication.
func (*Store) DeleteAuthentications ¶
func (s *Store) DeleteAuthentications(ctx context.Context, req *storageauth.DeleteAuthenticationsRequest) (err error)
DeleteAuthentications attempts to delete one or more Authentication instances from the backing store. Use auth.DeleteByID to construct a request to delete a single Authentication by ID string. Use auth.DeleteByMethod to construct a request to delete 0 or more Authentications by Method and optional expired before constraint.
func (*Store) ExpireAuthenticationByID ¶
func (s *Store) ExpireAuthenticationByID(ctx context.Context, id string, expireAt *timestamppb.Timestamp) (err error)
ExpireAuthenticationByID attempts to expire an Authentication by ID string and the provided expiry time.
func (*Store) GetAuthenticationByClientToken ¶
func (s *Store) GetAuthenticationByClientToken(ctx context.Context, clientToken string) (*rpcauth.Authentication, error)
GetAuthenticationByClientToken fetches the associated Authentication for the provided clientToken string.
Given a row is present for the hash of the clientToken then materialize into an Authentication. Else, given it cannot be located, a storage.ErrNotFound error is wrapped and returned instead.
func (*Store) GetAuthenticationByID ¶
func (s *Store) GetAuthenticationByID(ctx context.Context, id string) (*rpcauth.Authentication, error)
GetAuthenticationByID retrieves an instance of Authentication from the backing store using the provided id string.
func (*Store) ListAuthentications ¶
func (s *Store) ListAuthentications(ctx context.Context, req *storage.ListRequest[storageauth.ListAuthenticationsPredicate]) (set storage.ResultSet[*rpcauth.Authentication], err error)
ListAuthentications lists a page of Authentications from the backing store.