Documentation ¶
Index ¶
- type Driver
- func (t *Driver) CreateDirectory(ctx context.Context, d *v1.Directory) (*v1.Directory, error)
- func (t *Driver) CreateRoot(ctx context.Context, d *v1.Directory) (*v1.Directory, error)
- func (t *Driver) GetChildren(ctx context.Context, parent v1.DirectoryID) ([]v1.DirectoryID, error)
- func (t *Driver) GetDirectory(ctx context.Context, id v1.DirectoryID) (*v1.Directory, error)
- func (t *Driver) GetParents(ctx context.Context, child v1.DirectoryID) ([]v1.DirectoryID, error)
- func (t *Driver) GetParentsUntilAncestor(ctx context.Context, child, ancestor v1.DirectoryID) ([]v1.DirectoryID, error)
- func (t *Driver) ListRoots(ctx context.Context) ([]v1.DirectoryID, error)
- type Options
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Driver ¶
type Driver struct {
// contains filtered or unexported fields
}
func NewDirectoryDriver ¶ added in v0.0.2
func (*Driver) CreateDirectory ¶
func (*Driver) CreateRoot ¶
CreateRoot creates a root directory. Root directories are directories that have no parent directory. ID is generated by the database, it will be ignored if given.
func (*Driver) GetChildren ¶
func (t *Driver) GetChildren(ctx context.Context, parent v1.DirectoryID) ([]v1.DirectoryID, error)
func (*Driver) GetDirectory ¶
GetDirectoryByID returns a directory by its ID. Note that this call does not give out parent information.
func (*Driver) GetParents ¶
func (t *Driver) GetParents(ctx context.Context, child v1.DirectoryID) ([]v1.DirectoryID, error)
func (*Driver) GetParentsUntilAncestor ¶
func (t *Driver) GetParentsUntilAncestor( ctx context.Context, child, ancestor v1.DirectoryID, ) ([]v1.DirectoryID, error)
type Options ¶ added in v0.0.2
type Options func(*Driver)
Options defines ways to configure the CRDB driver.
func WithFastReads ¶ added in v0.0.2
func WithFastReads() Options
WithFastReads configures the driver to use fast reads. This is useful for read-only drivers. It will use a different query to read directories, which relies on follower reads. It is important to note that this query will not return the latest data, but it will return data that is consistent with the latest data.
func WithReadOnly ¶ added in v0.0.2
func WithReadOnly() Options
WithReadOnly configures the driver to be read-only.