rest

package
v0.0.0-...-a7b288f Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 25, 2023 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DatabaseSystem = "_system"
	RepoMeta       = "_meta"
	RepoLocal      = "local"
	BranchCommits  = "_commits"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type BaseIntroducer

type BaseIntroducer struct {
	// contains filtered or unexported fields
}

type BaseRequester

type BaseRequester struct {
	Client *Client
	// contains filtered or unexported fields
}

type Branch

type Branch struct {
	ID   string `json:"@id"`
	Type string `json:"@type"`
	Name string `json:"name"`
	Head string `json:"head"`
}

type BranchApplyOptions

type BranchApplyOptions struct {
	Message         string          `json:"-" default:"Default commit message"`
	Author          string          `json:"-" default:"defaultAuthor"`
	Keep            map[string]bool `json:"keep" default:"{\"@id\": true, \"@type\": true}"` // Fields to keep after apply
	MatchFinalState bool            `json:"match_final_state" default:"true"`
	Type            string          `json:"type,omitempty" default:"squash"`
}

type BranchCommitLogOptions

type BranchCommitLogOptions struct {
	Count int `url:"count" default:"-1"`
	Start int `url:"start" default:"0"`
}

type BranchCreateOptions

type BranchCreateOptions struct {
	// Origin is the thing we wish to create a branch out of. it can be any kind of branch descriptor or commit descriptor.
	Origin   string  `json:"origin,omitempty"`
	Schema   bool    `json:"schema,omitempty"`
	Prefixes *Prefix `json:"prefixes,omitempty"`
}

type BranchIntroducer

type BranchIntroducer BaseIntroducer

func (*BranchIntroducer) OnRepo

func (bi *BranchIntroducer) OnRepo(path RepoPath) *BranchRequester

type BranchPath

type BranchPath struct {
	Organization, Database, Repo, Branch string
}

func (BranchPath) FromString

func (bp BranchPath) FromString(s string) BranchPath

func (BranchPath) GetURL

func (bp BranchPath) GetURL(action string) string

func (BranchPath) String

func (bp BranchPath) String() string

type BranchPushOptions

type BranchPushOptions struct {
	PushPrefixes bool `json:"push_prefixes" default:"true"`
}

type BranchRebaseOptions

type BranchRebaseOptions struct {
	Author string `json:"author" default:"Default author"`
}

type BranchRequester

type BranchRequester BaseRequester

func (*BranchRequester) Apply

func (br *BranchRequester) Apply(branchName, beforeRef, afterRef string, options *BranchApplyOptions) (response TerminusResponse, err error)

beforeRef/afterRef could be commit identifiers or branch names

func (*BranchRequester) ApplyCommitsRange

func (br *BranchRequester) ApplyCommitsRange(branchName string, before, after Commit, options *BranchApplyOptions) (response TerminusResponse, err error)

func (*BranchRequester) CommitLog

func (br *BranchRequester) CommitLog(branchName string, buf *[]Commit, options *BranchCommitLogOptions) (response TerminusResponse, err error)

func (*BranchRequester) Create

func (br *BranchRequester) Create(branchName string, options *BranchCreateOptions) (response TerminusResponse, err error)

func (*BranchRequester) Delete

func (br *BranchRequester) Delete(branchName string) (response TerminusResponse, err error)

func (*BranchRequester) Get

func (br *BranchRequester) Get(branchName string, buf *Branch) (response TerminusResponse, err error)

func (*BranchRequester) ListAll

func (br *BranchRequester) ListAll(buf *[]Branch) (response TerminusResponse, err error)

func (*BranchRequester) Optimize

func (br *BranchRequester) Optimize(branchName string) (response TerminusResponse, err error)

func (*BranchRequester) Pull

func (br *BranchRequester) Pull(branchName, remote, remoteBranch string) (response TerminusResponse, err error)

func (*BranchRequester) Push

func (br *BranchRequester) Push(branchName, remote, remoteBranch string, options *BranchPushOptions) (response TerminusResponse, err error)

error conditions: - branch to push does not exist - repository does not exist - we tried to push to a repository that is not a remote - tried to push without having fetched first. The repository exists as an entity in our metadata graph but it hasn't got an associated commit graph. We always need one. - remote diverged - someone else committed and pushed and we know about that - We try to push an empty branch, but we know that remote is non-empty - remote returns an error -- history diverged (we check locally, but there's a race) -- remote doesn't know what we're talking about -- remote authorization failed - communication error while talking to the remote

func (*BranchRequester) Rebase

func (br *BranchRequester) Rebase(branchName string, rebaseFrom TerminusObjectPath, options *BranchRebaseOptions) (response TerminusResponse, err error)

func (*BranchRequester) RebaseFromPath

func (br *BranchRequester) RebaseFromPath(branchName, rebaseFrom string, options *BranchRebaseOptions) (response TerminusResponse, err error)

func (*BranchRequester) Reset

func (br *BranchRequester) Reset(branchName string, commit Commit) (response TerminusResponse, err error)

func (*BranchRequester) SchemaFrameAll

func (br *BranchRequester) SchemaFrameAll(branchName string, buf *[]schema.RawSchemaItem, options *BranchSchemaFrameOptions) (response TerminusResponse, err error)

func (*BranchRequester) SchemaFrameType

func (br *BranchRequester) SchemaFrameType(branchName, docType string, buf *schema.RawSchemaItem, options *BranchSchemaFrameOptions) (response TerminusResponse, err error)

func (*BranchRequester) Squash

func (br *BranchRequester) Squash(branchName string, options *BranchSquashOptions) (response TerminusResponse, err error)

func (*BranchRequester) WithContext

func (br *BranchRequester) WithContext(ctx context.Context) *BranchRequester

type BranchSchemaFrameOptions

type BranchSchemaFrameOptions struct {
	CompressIDs    bool `url:"compress_ids" default:"true"`
	ExpandAbstract bool `url:"expand_abstract" default:"true"`
}

type BranchSquashOptions

type BranchSquashOptions struct {
	Author  string `json:"author" default:"defaultAuthor"`
	Message string `json:"message" default:"Default commit message"`
}

type Client

type Client struct {
	C *sling.Sling
	// contains filtered or unexported fields
}

TODO: move Client from rest to another place TODO: api_init.pl paths and filenames and headers

func NewClient

func NewClient(client *http.Client, hostPath string) *Client

func (*Client) Branches

func (c *Client) Branches() *BranchIntroducer

func (*Client) Databases

func (c *Client) Databases() *DatabaseIntroducer

func (*Client) Diffs

func (c *Client) Diffs() *DiffRequester

func (*Client) Files

func (c *Client) Files() *FilesIntroducer

func (*Client) GenericDocuments

func (c *Client) GenericDocuments() *DocumentIntroducer[GenericDocument]

func (*Client) Organizations

func (c *Client) Organizations() *OrganizationRequester

func (*Client) Ping

func (c *Client) Ping(ctx context.Context) (response TerminusResponse, err error)

func (*Client) Remotes

func (c *Client) Remotes() *RemoteIntroducer

func (*Client) Repos

func (c *Client) Repos() *RepoIntroducer

func (*Client) Roles

func (c *Client) Roles() *RoleRequester

func (*Client) Users

func (c *Client) Users() *UserIntroducer

func (*Client) VersionInfo

func (c *Client) VersionInfo(ctx context.Context, buf *TerminusVersionInfo) (response TerminusResponse, err error)

func (*Client) WOQL

func (c *Client) WOQL(ctx context.Context, query bare.RawQuery, buf *srverror.WOQLResponse, options *ClientWOQLOptions) (response TerminusResponse, err error)

Query with empty db context

func (*Client) WithBasicAuth

func (c *Client) WithBasicAuth(user, password string) *Client

func (*Client) WithJWTAuth

func (c *Client) WithJWTAuth(jwtToken string) *Client

func (*Client) WithTokenAuth

func (c *Client) WithTokenAuth(token string) *Client

func (*Client) WithUsernameAuth

func (c *Client) WithUsernameAuth(header, username string) *Client

Must be enabled in server config in TERMINUSDB_INSECURE_USER_HEADER_ENABLED and TERMINUSDB_INSECURE_USER_HEADER

type ClientWOQLOptions

type ClientWOQLOptions struct {
	CommitAuthor  string
	CommitMessage string
	AllWitnesses  bool
}

type Commit

type Commit struct {
	ID         string  `json:"@id"`
	Type       string  `json:"@type"`
	Author     string  `json:"author"`
	Identifier string  `json:"identifier"`
	Instance   string  `json:"instance"`
	Message    string  `json:"message"`
	Parent     string  `json:"parent"`
	Schema     string  `json:"schema"`
	Timestamp  float64 `json:"timestamp"`
}

type CommitPath

type CommitPath struct {
	Organization, Database, Repo, Branch, Commit string
}

func (CommitPath) FromString

func (cp CommitPath) FromString(s string) CommitPath

func (CommitPath) GetURL

func (cp CommitPath) GetURL(action string) string

func (CommitPath) String

func (cp CommitPath) String() string

type ComponentVersion

type ComponentVersion struct {
	Version string `json:"version"`
	GitHash string `json:"git_hash,omitempty"`
}

type Database

type Database struct {
	ID           string    `json:"@id"`
	Type         string    `json:"@type"`
	Name         string    `json:"name"`
	Comment      string    `json:"comment"`
	CreationDate time.Time `json:"creation_date"`
	Label        string    `json:"label"`
	State        string    `json:"state"`
	Path         string    `json:"path"`
	Branches     []string  `json:"branches"`
}

type DatabaseCloneOptions

type DatabaseCloneOptions struct {
	Public    bool   `json:"public"`
	RemoteURL string `json:"remote_url" default:"http://example.com/user/test_db"`
	Comment   string `json:"comment" default:"Default comment"`
}

type DatabaseCommitLogOptions

type DatabaseCommitLogOptions struct {
	Count int `url:"count" default:"-1"`
	Start int `url:"start,omitempty" default:"0"`
}

type DatabaseCreateOptions

type DatabaseCreateOptions struct {
	Schema   bool    `json:"schema" default:"true"`
	Public   bool    `json:"public,omitempty"`
	Comment  string  `json:"comment,omitempty"`
	Prefixes *Prefix `json:"prefixes,omitempty"`
}

type DatabaseDeleteOptions

type DatabaseDeleteOptions struct {
	Force bool `url:"force,omitempty"`
}

type DatabaseIntroducer

type DatabaseIntroducer struct {
	BaseIntroducer
	// contains filtered or unexported fields
}

func (*DatabaseIntroducer) ListAll

func (di *DatabaseIntroducer) ListAll(buf *[]Database) (response TerminusResponse, err error)

func (*DatabaseIntroducer) ListAllOwned

func (di *DatabaseIntroducer) ListAllOwned(buf *[]Database) (response TerminusResponse, err error)

func (*DatabaseIntroducer) OnOrganization

func (di *DatabaseIntroducer) OnOrganization(path OrganizationPath) *DatabaseRequester

func (*DatabaseIntroducer) WithContext

func (di *DatabaseIntroducer) WithContext(ctx context.Context) *DatabaseIntroducer

type DatabasePackOptions

type DatabasePackOptions struct {
	RepositoryHead string `json:"repository_head,omitempty"`
}

type DatabasePath

type DatabasePath struct {
	Organization, Database string
}

func (DatabasePath) FromString

func (dp DatabasePath) FromString(s string) DatabasePath

func (DatabasePath) GetURL

func (dp DatabasePath) GetURL(action string) string

func (DatabasePath) String

func (dp DatabasePath) String() string

type DatabaseRequester

type DatabaseRequester struct {
	BaseRequester
	// contains filtered or unexported fields
}

func (*DatabaseRequester) Clone

func (dr *DatabaseRequester) Clone(newName, newLabel string, options *DatabaseCloneOptions) (response TerminusResponse, err error)

func (*DatabaseRequester) CommitLog

func (dr *DatabaseRequester) CommitLog(name string, buf *[]Commit, options *DatabaseCommitLogOptions) (response TerminusResponse, err error)

func (*DatabaseRequester) Create

func (dr *DatabaseRequester) Create(name, label string, options *DatabaseCreateOptions) (response TerminusResponse, err error)

func (*DatabaseRequester) Delete

func (dr *DatabaseRequester) Delete(name string, options *DatabaseDeleteOptions) (response TerminusResponse, err error)

func (*DatabaseRequester) Get

func (dr *DatabaseRequester) Get(name string, buf *Database) (response TerminusResponse, err error)

func (*DatabaseRequester) IsExists

func (dr *DatabaseRequester) IsExists(name string) (exists bool, response TerminusResponse, err error)

func (*DatabaseRequester) ListAll

func (dr *DatabaseRequester) ListAll(userName string, buf *[]Database) (response TerminusResponse, err error)

func (*DatabaseRequester) Optimize

func (dr *DatabaseRequester) Optimize(dbName string) (response TerminusResponse, err error)

func (*DatabaseRequester) Pack

func (dr *DatabaseRequester) Pack(name string, w io.Writer, options *DatabasePackOptions) (writtenBytes int64, response TerminusResponse, err error)

func (*DatabaseRequester) Prefixes

func (dr *DatabaseRequester) Prefixes(dbName string, buf *Prefix) (response TerminusResponse, err error)

TODO: figure out what prefixes are

func (*DatabaseRequester) SchemaFrameAll

func (dr *DatabaseRequester) SchemaFrameAll(name string, buf *[]schema.RawSchemaItem, options *DatabaseSchemaFrameOptions) (response TerminusResponse, err error)

func (*DatabaseRequester) SchemaFrameType

func (dr *DatabaseRequester) SchemaFrameType(name, docType string, buf *schema.RawSchemaItem, options *DatabaseSchemaFrameOptions) (response TerminusResponse, err error)

func (*DatabaseRequester) UnpackTusResource

func (dr *DatabaseRequester) UnpackTusResource(dbName, tusLocation string) (readBytes int64, response TerminusResponse, err error)

func (*DatabaseRequester) UnpackUpload

func (dr *DatabaseRequester) UnpackUpload(dbName string, data io.Reader) (readBytes int64, response TerminusResponse, err error)

func (*DatabaseRequester) Update

func (dr *DatabaseRequester) Update(name string, options *DatabaseUpdateOptions) (response TerminusResponse, err error)

func (*DatabaseRequester) WOQL

func (dr *DatabaseRequester) WOQL(name string, query bare.RawQuery, buf *srverror.WOQLResponse, options *DatabaseWOQLOptions) (response TerminusResponse, err error)

Query with database context

func (*DatabaseRequester) WithContext

func (dr *DatabaseRequester) WithContext(ctx context.Context) *DatabaseRequester

func (*DatabaseRequester) WithDataVersion

func (dr *DatabaseRequester) WithDataVersion(dataVersion string) *DatabaseRequester

type DatabaseSchemaFrameOptions

type DatabaseSchemaFrameOptions struct {
	CompressIDs    bool `url:"compress_ids" default:"true"`
	ExpandAbstract bool `url:"expand_abstract" default:"true"`
}

type DatabaseUpdateOptions

type DatabaseUpdateOptions struct {
	Schema   bool    `json:"schema,omitempty"`
	Public   bool    `json:"public,omitempty"`
	Label    string  `json:"label,omitempty"`
	Comment  string  `json:"comment,omitempty"`
	Prefixes *Prefix `json:"prefixes,omitempty"`
}

type DatabaseWOQLOptions

type DatabaseWOQLOptions struct {
	CommitAuthor  string
	CommitMessage string
	AllWitnesses  bool
}

type Diff

type Diff map[string]any

type DiffOp

type DiffOp string
const (
	DiffOpSwapValue   DiffOp = "SwapValue"
	DiffOpForceValue  DiffOp = "ForceValue"
	DiffOpCopyList    DiffOp = "CopyList"
	DiffOpSwapList    DiffOp = "SwapList"
	DiffOpPatchList   DiffOp = "PatchList"
	DiffOpKeepList    DiffOp = "KeepList"
	DiffOpModifyTable DiffOp = "ModifyTable"
)

type DiffOptions

type DiffOptions struct {
	DiffShortOptions
	Before            any    `json:"before,omitempty"`
	After             any    `json:"after,omitempty"`
	BeforeDataVersion string `json:"before_data_version,omitempty"`
	AfterDataVersion  string `json:"after_data_version,omitempty"`
	DocumentID        string `json:"document_id,omitempty"`
}

type DiffRequester

type DiffRequester BaseRequester

func (*DiffRequester) Diff

func (dr *DiffRequester) Diff(buf *Diff, options *DiffOptions) (response TerminusResponse, err error)

func (*DiffRequester) DiffAllDocsRevisions

func (dr *DiffRequester) DiffAllDocsRevisions(revisionBefore, revisionAfter string, buf *Diff, options *DiffShortOptions) (response TerminusResponse, err error)

func (*DiffRequester) DiffDocRevisions

func (dr *DiffRequester) DiffDocRevisions(revisionBefore, revisionAfter string, buf *Diff, docID string, options *DiffShortOptions) (response TerminusResponse, err error)

func (*DiffRequester) DiffObjAndDocRevision

func (dr *DiffRequester) DiffObjAndDocRevision(docRevision string, obj any, buf *Diff, docID string, options *DiffShortOptions) (response TerminusResponse, err error)

func (*DiffRequester) DiffObjs

func (dr *DiffRequester) DiffObjs(objBefore, objAfter any, buf *Diff, options *DiffShortOptions) (response TerminusResponse, err error)

func (*DiffRequester) Patch

func (dr *DiffRequester) Patch(before any, diff *Diff, buf any) (response TerminusResponse, err error)

func (*DiffRequester) WithContext

func (dr *DiffRequester) WithContext(ctx context.Context) *DiffRequester

type DiffShortOptions

type DiffShortOptions struct {
	Keep      map[string]bool `json:"keep,omitempty"`
	CopyValue bool            `json:"copy_value,omitempty"`
}

type DocumentCreateOptions

type DocumentCreateOptions struct {
	GraphType   GraphTypes `url:"graph_type" default:"instance"`
	Message     string     `url:"message" default:"Default message"`
	Author      string     `url:"author" default:"Default author"`
	RawJSON     bool       `url:"raw_json,omitempty"`
	FullReplace bool       `url:"full_replace,omitempty"`
}

type DocumentDeleteOptions

type DocumentDeleteOptions struct {
	GraphType GraphTypes `url:"graph_type" default:"instance"`
	Message   string     `url:"message" default:"Default message"`
	Author    string     `url:"author" default:"Default author"`
	Nuke      bool       `url:"nuke,omitempty"`
	ID        string     `url:"id,omitempty"`
}

type DocumentGetOptions

type DocumentGetOptions struct {
	CompressIDs bool       `url:"compress_ids" default:"true"`
	Type        string     `url:"type,omitempty"`
	Unfold      bool       `url:"unfold" default:"true"`
	GraphType   GraphTypes `url:"graph_type" default:"instance"`
	Prefixed    bool       `url:"prefixed" default:"true"`
}

type DocumentIntroducer

type DocumentIntroducer[DocumentT any] BaseIntroducer

TODO: Mention that DocumentT must have proper json tags to be unmarshalled from response

func (*DocumentIntroducer[DocumentT]) OnBranch

func (di *DocumentIntroducer[DocumentT]) OnBranch(path BranchPath) *DocumentRequester[DocumentT]

func (*DocumentIntroducer[DocumentT]) OnCommit

func (di *DocumentIntroducer[DocumentT]) OnCommit(path CommitPath) *DocumentRequester[DocumentT]

func (*DocumentIntroducer[DocumentT]) OnDatabase

func (di *DocumentIntroducer[DocumentT]) OnDatabase(path DatabasePath) *DocumentRequester[DocumentT]

type DocumentIsExistsOptions

type DocumentIsExistsOptions struct {
	GraphType GraphTypes `url:"graph_type" default:"instance"`
}

type DocumentListOptions

type DocumentListOptions struct {
	CompressIDs bool       `url:"compress_ids" default:"true"`
	Type        string     `url:"type,omitempty"`
	Unfold      bool       `url:"unfold" default:"true"`
	Count       int        `url:"count,omitempty"`
	Skip        int        `url:"skip" default:"0"`
	GraphType   GraphTypes `url:"graph_type" default:"instance"`
	Prefixed    bool       `url:"prefixed" default:"true"`
}

type DocumentRequester

type DocumentRequester[DocumentT any] struct {
	BaseRequester
	// contains filtered or unexported fields
}

func (*DocumentRequester[DocumentT]) Create

func (dr *DocumentRequester[DocumentT]) Create(doc DocumentT, options *DocumentCreateOptions) (response TerminusResponse, err error)

func (*DocumentRequester[DocumentT]) CreateBulk

func (dr *DocumentRequester[DocumentT]) CreateBulk(docs []DocumentT, options *DocumentCreateOptions) (insertedIDs []string, response TerminusResponse, err error)

func (*DocumentRequester[DocumentT]) Delete

func (dr *DocumentRequester[DocumentT]) Delete(docID string, options *DocumentDeleteOptions) (response TerminusResponse, err error)

func (*DocumentRequester[DocumentT]) DeleteBulk

func (dr *DocumentRequester[DocumentT]) DeleteBulk(docIDs []string, options *DocumentDeleteOptions) (deletedIDs []string, response TerminusResponse, err error)

func (*DocumentRequester[DocumentT]) Get

func (dr *DocumentRequester[DocumentT]) Get(docID string, buf *DocumentT, options *DocumentGetOptions) (response TerminusResponse, err error)

func (*DocumentRequester[DocumentT]) IsExists

func (dr *DocumentRequester[DocumentT]) IsExists(options *DocumentIsExistsOptions) (exists bool, response TerminusResponse, err error)

func (*DocumentRequester[DocumentT]) ListAll

func (dr *DocumentRequester[DocumentT]) ListAll(buf *[]DocumentT, options *DocumentListOptions) (response TerminusResponse, err error)

func (*DocumentRequester[DocumentT]) ListAllIterator

func (dr *DocumentRequester[DocumentT]) ListAllIterator(items chan<- DocumentT, options *DocumentListOptions) (response *http.Response, err error)

func (*DocumentRequester[DocumentT]) Update

func (dr *DocumentRequester[DocumentT]) Update(doc DocumentT, options *DocumentUpdateOptions) (response TerminusResponse, err error)

func (*DocumentRequester[DocumentT]) UpdateBulk

func (dr *DocumentRequester[DocumentT]) UpdateBulk(docs []DocumentT, options *DocumentUpdateOptions) (updatedIDs []string, response TerminusResponse, err error)

func (*DocumentRequester[DocumentT]) WithContext

func (dr *DocumentRequester[DocumentT]) WithContext(ctx context.Context) *DocumentRequester[DocumentT]

func (*DocumentRequester[DocumentT]) WithDataVersion

func (dr *DocumentRequester[DocumentT]) WithDataVersion(dataVersion string) *DocumentRequester[DocumentT]

type DocumentUpdateOptions

type DocumentUpdateOptions struct {
	GraphType GraphTypes `url:"graph_type" default:"instance"`
	Message   string     `url:"message" default:"Default message"`
	Author    string     `url:"author" default:"Default author"`
	RawJSON   bool       `url:"raw_json,omitempty"`
	Create    bool       `url:"create,omitempty"`
}

type FilesIntroducer

type FilesIntroducer struct {
	BaseIntroducer
	// contains filtered or unexported fields
}

func (*FilesIntroducer) GetClient

func (fi *FilesIntroducer) GetClient() *tusc.Client

func (*FilesIntroducer) WithContext

func (fi *FilesIntroducer) WithContext(ctx context.Context) *FilesIntroducer

func (*FilesIntroducer) WithRemoteBaseURI

func (fi *FilesIntroducer) WithRemoteBaseURI(baseURI string) *FilesIntroducer

type GenericDocument

type GenericDocument map[string]any

TODO: document can be also a list, a schema for instance https://terminusdb.com/docs/guides/reference-guides/json-diff-and-patch#patch-examples-using-curl

type GraphTypes

type GraphTypes string
const (
	GraphTypeInstance GraphTypes = "instance"
	GraphTypeSchema   GraphTypes = "schema"
)

type Organization

type Organization struct {
	ID          string   `json:"@id"`
	Type        string   `json:"@type"`
	Name        string   `json:"name"`
	DatabaseIDs []string `json:"database"`
}

TODO: seems that these structures are items of system_schema items and should be aligned with it (lack of `child` field below for example) (but no Remote in system_schema for example)

type OrganizationPath

type OrganizationPath struct {
	Organization string
}

func (OrganizationPath) FromString

func (op OrganizationPath) FromString(s string) OrganizationPath

func (OrganizationPath) GetURL

func (op OrganizationPath) GetURL(action string) string

func (OrganizationPath) String

func (op OrganizationPath) String() string

type OrganizationRequester

type OrganizationRequester BaseRequester

func (*OrganizationRequester) Create

func (or *OrganizationRequester) Create(name string) (response TerminusResponse, err error)

func (*OrganizationRequester) Delete

func (or *OrganizationRequester) Delete(name string) (response TerminusResponse, err error)

func (*OrganizationRequester) Get

func (or *OrganizationRequester) Get(name string, buf *Organization) (response TerminusResponse, err error)

func (*OrganizationRequester) ListAll

func (or *OrganizationRequester) ListAll(buf *[]Organization) (response TerminusResponse, err error)

func (*OrganizationRequester) WithContext

type Prefix

type Prefix struct {
	Base   string `json:"@base"`
	Schema string `json:"@schema"`
	Type   string `json:"@type"`
}

type Remote

type Remote struct {
	Name     string `json:"remote_name"`
	Location string `json:"remote_location"`
}

type RemoteIntroducer

type RemoteIntroducer BaseIntroducer

func (*RemoteIntroducer) OnDatabase

func (ri *RemoteIntroducer) OnDatabase(path DatabasePath) *RemoteRequester

type RemoteRequester

type RemoteRequester BaseRequester

func (*RemoteRequester) Create

func (rr *RemoteRequester) Create(name, uri string) (response TerminusResponse, err error)

func (*RemoteRequester) Delete

func (rr *RemoteRequester) Delete(name string) (response TerminusResponse, err error)

func (*RemoteRequester) Get

func (rr *RemoteRequester) Get(name string, buf *Remote) (response TerminusResponse, err error)

func (*RemoteRequester) ListAllNames

func (rr *RemoteRequester) ListAllNames(buf *[]string) (response TerminusResponse, err error)

func (*RemoteRequester) Update

func (rr *RemoteRequester) Update(name, uri string) (response TerminusResponse, err error)

func (*RemoteRequester) WithContext

func (rr *RemoteRequester) WithContext(ctx context.Context) *RemoteRequester

type RepoIntroducer

type RepoIntroducer BaseIntroducer

func (*RepoIntroducer) OnDatabase

func (ri *RepoIntroducer) OnDatabase(path DatabasePath) *RepoRequester

type RepoPath

type RepoPath struct {
	Organization, Database, Repo string
}

func (RepoPath) FromString

func (rp RepoPath) FromString(s string) RepoPath

func (RepoPath) GetURL

func (rp RepoPath) GetURL(action string) string

func (RepoPath) String

func (rp RepoPath) String() string

type RepoRequester

type RepoRequester struct {
	BaseRequester
}

func (*RepoRequester) Fetch

func (rr *RepoRequester) Fetch(repoID, remoteAuthorization string) (response TerminusResponse, err error)

func (*RepoRequester) Optimize

func (rr *RepoRequester) Optimize(repoID string) (response TerminusResponse, err error)

func (*RepoRequester) SchemaFrameAll

func (rr *RepoRequester) SchemaFrameAll(name string, buf *[]schema.RawSchemaItem, options *RepoSchemaFrameOptions) (response TerminusResponse, err error)

func (*RepoRequester) SchemaFrameType

func (rr *RepoRequester) SchemaFrameType(name, docType string, buf *schema.RawSchemaItem, options *RepoSchemaFrameOptions) (response TerminusResponse, err error)

func (*RepoRequester) WithContext

func (rr *RepoRequester) WithContext(ctx context.Context) *RepoRequester

type RepoSchemaFrameOptions

type RepoSchemaFrameOptions struct {
	CompressIDs    bool `url:"compress_ids" default:"true"`
	ExpandAbstract bool `url:"expand_abstract" default:"true"`
}

type Role

type Role struct {
	ID     string       `json:"@id"`
	Type   string       `json:"@type"`
	Name   string       `json:"name"`
	Action []RoleAction `json:"action"`
}

type RoleAction

type RoleAction string
const (
	RoleActionCreateDatabase      RoleAction = "create_database"
	RoleActionDeleteDatabase      RoleAction = "delete_database"
	RoleActionClassFrame          RoleAction = "class_frame"
	RoleActionClone               RoleAction = "clone"
	RoleActionFetch               RoleAction = "fetch"
	RoleActionPush                RoleAction = "push"
	RoleActionBranch              RoleAction = "branch"
	RoleActionRebase              RoleAction = "rebase"
	RoleActionInstanceReadAccess  RoleAction = "instance_read_access"
	RoleActionInstanceWriteAccess RoleAction = "instance_write_access"
	RoleActionSchemaReadAccess    RoleAction = "schema_read_access"
	RoleActionSchemaWriteAccess   RoleAction = "schema_write_access"
	RoleActionMetaReadAccess      RoleAction = "meta_read_access"
	RoleActionMetaWriteAccess     RoleAction = "meta_write_access"
	RoleActionCommitReadAccess    RoleAction = "commit_read_access"
	RoleActionCommitWriteAccess   RoleAction = "commit_write_access"
	RoleActionManageCapabilities  RoleAction = "manage_capabilities"
)

type RoleCreateOptions

type RoleCreateOptions struct {
	Action []RoleAction `json:"action"`
}

type RoleRequester

type RoleRequester BaseRequester

func (*RoleRequester) Create

func (rr *RoleRequester) Create(name string, options *RoleCreateOptions) (response TerminusResponse, err error)

func (*RoleRequester) Delete

func (rr *RoleRequester) Delete(name string) (response TerminusResponse, err error)

func (*RoleRequester) Get

func (rr *RoleRequester) Get(name string, buf *Role) (response TerminusResponse, err error)

func (*RoleRequester) ListAll

func (rr *RoleRequester) ListAll(buf *[]Role) (response TerminusResponse, err error)

func (*RoleRequester) Update

func (rr *RoleRequester) Update(name string, options *RoleUpdateOptions) (response TerminusResponse, err error)

func (*RoleRequester) WithContext

func (rr *RoleRequester) WithContext(ctx context.Context) *RoleRequester

type RoleUpdateOptions

type RoleUpdateOptions struct {
	Action []RoleAction `json:"action"`
}

type TerminusObject

type TerminusObject any

type TerminusObjectPath

type TerminusObjectPath interface {
	fmt.Stringer
	GetURL(action string) string
}

type TerminusResponse

type TerminusResponse interface {
	fmt.Stringer
	IsOK() bool
}

type TerminusVersionInfo

type TerminusVersionInfo struct {
	Authority       string           `json:"authority"`
	Storage         ComponentVersion `json:"storage"`
	TerminusDB      ComponentVersion `json:"terminusdb"`
	TerminusDBStore ComponentVersion `json:"terminusdb_store"`
}

type TripleDumpOptions

type TripleDumpOptions struct {
	GraphType GraphTypes `url:"-" default:"instance"`
	Format    string     `url:"format" default:"turtle"`
}

type TripleInsertOptions

type TripleInsertOptions struct {
	GraphType GraphTypes `json:"-" default:"instance"`
	Author    string     `json:"author" default:"defaultAuthor"`
	Message   string     `json:"message" default:"Default commit message"`
}

type TripleIntroducer

type TripleIntroducer BaseIntroducer

func (*TripleIntroducer) OnBranch

func (di *TripleIntroducer) OnBranch(path BranchPath) *TripleRequester

func (*TripleIntroducer) OnCommit

func (di *TripleIntroducer) OnCommit(path CommitPath) *TripleRequester

func (*TripleIntroducer) OnDatabase

func (di *TripleIntroducer) OnDatabase(path DatabasePath) *TripleRequester

func (*TripleIntroducer) OnRepo

func (di *TripleIntroducer) OnRepo(path RepoPath) *TripleRequester

type TripleRequester

type TripleRequester BaseRequester

func (*TripleRequester) DumpAsStream

func (tr *TripleRequester) DumpAsStream(w io.Writer, options *TripleDumpOptions) (writtenBytes int64, response TerminusResponse, err error)

func (*TripleRequester) DumpAsString

func (tr *TripleRequester) DumpAsString(buf *string, options *TripleDumpOptions) (response TerminusResponse, err error)

func (*TripleRequester) Insert

func (tr *TripleRequester) Insert(data *string, options *TripleInsertOptions) (response TerminusResponse, err error)

func (*TripleRequester) Update

func (tr *TripleRequester) Update(data *string, options *TripleUpdateOptions) (response TerminusResponse, err error)

func (*TripleRequester) WithContext

func (tr *TripleRequester) WithContext(ctx context.Context) *TripleRequester

type TripleUpdateOptions

type TripleUpdateOptions struct {
	GraphType GraphTypes `json:"-" default:"instance"`
	Author    string     `json:"author" default:"defaultAuthor"`
	Message   string     `json:"message" default:"Default commit message"`
}

type User

type User struct {
	ID           string                                     `json:"@id"`
	Type         string                                     `json:"@type"`
	Name         string                                     `json:"name"`
	Capabilities []srverror.Union[UserCapability, []string] `json:"capability"`
}

type UserCapabilitiesOperation

type UserCapabilitiesOperation string
const (
	UserCapabilitiesGrant  UserCapabilitiesOperation = "grant"
	UserCapabilitiesRevoke UserCapabilitiesOperation = "revoke"
)

type UserCapability

type UserCapability struct {
	ID    string         `json:"@id"`
	Type  string         `json:"@type"`
	Role  []Role         `json:"role"`
	Scope TerminusObject `json:"scope"`
}

type UserGetOptions

type UserGetOptions struct {
	Capability bool `url:"capability" default:"false"` // True to expand `capability` into "Capability" schema item list, False to get them as string list
}

type UserIntroducer

type UserIntroducer BaseIntroducer

func (*UserIntroducer) OnOrganization

func (ui *UserIntroducer) OnOrganization(path OrganizationPath) *UserRequester

func (*UserIntroducer) OnServer

func (ui *UserIntroducer) OnServer() *UserRequester

type UserListAllOptions

type UserListAllOptions struct {
	Capability bool `url:"capability" default:"false"` // True to expand `capability` into "Capability" schema item list, False to get them as string list
}

type UserPath

type UserPath struct {
	Organization, User string
}

func (UserPath) FromString

func (up UserPath) FromString(s string) UserPath

func (UserPath) GetURL

func (up UserPath) GetURL(action string) string

func (UserPath) String

func (up UserPath) String() string

type UserRequester

type UserRequester BaseRequester

func (*UserRequester) Create

func (ur *UserRequester) Create(name, password string) (response TerminusResponse, err error)

func (*UserRequester) Delete

func (ur *UserRequester) Delete(name string) (response TerminusResponse, err error)

func (*UserRequester) Get

func (ur *UserRequester) Get(name string, buf *User, options *UserGetOptions) (response TerminusResponse, err error)

func (*UserRequester) ListAll

func (ur *UserRequester) ListAll(buf *[]User, options *UserListAllOptions) (response TerminusResponse, err error)

func (*UserRequester) UpdateCapabilities

func (ur *UserRequester) UpdateCapabilities(name string, options *UserUpdateCapabilitiesOptions) (response TerminusResponse, err error)

func (*UserRequester) UpdatePassword

func (ur *UserRequester) UpdatePassword(name, password string) (response TerminusResponse, err error)

func (*UserRequester) WithContext

func (ur *UserRequester) WithContext(ctx context.Context) *UserRequester

type UserUpdateCapabilitiesOptions

type UserUpdateCapabilitiesOptions struct {
	Scope     TerminusObject
	Roles     []Role
	Operation UserCapabilitiesOperation `default:"revoke"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL