Documentation ¶
Overview ¶
Package sqlcommon contains utility functions shared among all SQL data stores.
Index ¶
- func HandleSQLError(err error, args ...interface{}) error
- func Write(ctx context.Context, dbInfo *DBInfo, store string, deletes storage.Deletes, ...) error
- type Config
- type ContToken
- type DBInfo
- type DatastoreOption
- func WithConnMaxIdleTime(d time.Duration) DatastoreOption
- func WithConnMaxLifetime(d time.Duration) DatastoreOption
- func WithLogger(l logger.Logger) DatastoreOption
- func WithMaxIdleConns(c int) DatastoreOption
- func WithMaxOpenConns(c int) DatastoreOption
- func WithMaxTuplesPerWrite(maxTuples int) DatastoreOption
- func WithMaxTypesPerAuthorizationModel(maxTypes int) DatastoreOption
- func WithPassword(password string) DatastoreOption
- func WithUsername(username string) DatastoreOption
- type SQLTupleIterator
- type TupleRecord
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func HandleSQLError ¶
Types ¶
type Config ¶
type Config struct { Username string Password string Logger logger.Logger MaxTuplesPerWriteField int MaxTypesPerModelField int MaxOpenConns int MaxIdleConns int ConnMaxIdleTime time.Duration ConnMaxLifetime time.Duration }
func NewConfig ¶
func NewConfig(opts ...DatastoreOption) *Config
type DBInfo ¶
type DBInfo struct {
// contains filtered or unexported fields
}
DBInfo encapsulates DB information for use in common method
type DatastoreOption ¶
type DatastoreOption func(*Config)
func WithConnMaxIdleTime ¶
func WithConnMaxIdleTime(d time.Duration) DatastoreOption
func WithConnMaxLifetime ¶
func WithConnMaxLifetime(d time.Duration) DatastoreOption
func WithLogger ¶
func WithLogger(l logger.Logger) DatastoreOption
func WithMaxIdleConns ¶
func WithMaxIdleConns(c int) DatastoreOption
func WithMaxOpenConns ¶
func WithMaxOpenConns(c int) DatastoreOption
func WithMaxTuplesPerWrite ¶
func WithMaxTuplesPerWrite(maxTuples int) DatastoreOption
func WithMaxTypesPerAuthorizationModel ¶
func WithMaxTypesPerAuthorizationModel(maxTypes int) DatastoreOption
func WithPassword ¶ added in v1.1.0
func WithPassword(password string) DatastoreOption
func WithUsername ¶ added in v1.1.0
func WithUsername(username string) DatastoreOption
type SQLTupleIterator ¶
type SQLTupleIterator struct {
// contains filtered or unexported fields
}
func NewSQLTupleIterator ¶
func NewSQLTupleIterator(rows *sql.Rows) *SQLTupleIterator
NewSQLTupleIterator returns a SQL tuple iterator
func (*SQLTupleIterator) Stop ¶
func (t *SQLTupleIterator) Stop()
func (*SQLTupleIterator) ToArray ¶
func (t *SQLTupleIterator) ToArray(opts storage.PaginationOptions) ([]*openfgav1.Tuple, []byte, error)
ToArray converts the tupleIterator to an []*openfgav1.Tuple and a possibly empty continuation token. If the continuation token exists it is the ulid of the last element of the returned array.
Click to show internal directories.
Click to hide internal directories.