Documentation
¶
Overview ¶
Package git provides a Git connector for Braidplane data sources. It executes file read/write operations against a Git repository via shallow clones.
Index ¶
Constants ¶
const ( QueryFormatUnknown = filedata.QueryFormatUnknown QueryFormatAuto = filedata.QueryFormatAuto QueryFormatCSV = filedata.QueryFormatCSV QueryFormatJSON = filedata.QueryFormatJSON QueryFormatFile = filedata.QueryFormatFile QueryFormatSpreadsheet = filedata.QueryFormatSpreadsheet )
Variables ¶
This section is empty.
Functions ¶
func AuthEnv ¶
func AuthEnv( creds Credentials, ) (env []string, modifyURL func(string) (string, error), cleanup func(), err error)
AuthEnv returns the git environment variables and a URL modifier needed to perform raw git operations (ls-remote, clone, push) with the given credentials. For HTTPS: Git's credential helper reads credentials from the child environment. For SSH: a temp key file is written and GIT_SSH_COMMAND is set. The returned cleanup func must be called (via defer) to remove temp files.
func AuthTypeStrings ¶
func AuthTypeStrings() []string
AuthTypeStrings returns a slice of all String values of the enum
Types ¶
type AuthType ¶
type AuthType int
func AuthTypeString ¶
AuthTypeString retrieves an enum value from the enum constants string name. Throws an error if the param is not part of the enum.
func AuthTypeValues ¶
func AuthTypeValues() []AuthType
AuthTypeValues returns all values of the enum
func (AuthType) IsAAuthType ¶
IsAAuthType returns "true" if the value is listed in the enum definition. "false" otherwise
func (AuthType) MarshalJSON ¶
MarshalJSON implements the json.Marshaler interface for AuthType
func (AuthType) MarshalText ¶
MarshalText implements the encoding.TextMarshaler interface for AuthType
func (*AuthType) UnmarshalJSON ¶
UnmarshalJSON implements the json.Unmarshaler interface for AuthType
func (*AuthType) UnmarshalText ¶
UnmarshalText implements the encoding.TextUnmarshaler interface for AuthType
type Config ¶
type Config struct {
RepoURL string `json:"repo_url" validate:"required,min=1"`
DefaultBranch string `json:"default_branch,omitempty"`
BasePath string `json:"base_path,omitempty"`
AllowPrivateHosts bool `json:"allow_private_hosts,omitempty"`
}
Config holds configuration for Git repository connections.
type Connector ¶
type Connector struct {
// contains filtered or unexported fields
}
Connector is a stateless Git connector. Each operation performs a shallow clone.
func New ¶
New creates a new Git connector after validating config and credentials. It does NOT establish a persistent connection.
func (*Connector) Execute ¶
func (c *Connector) Execute( ctx context.Context, queryData json.RawMessage, params map[string]types.TypedParam, limits ...types.ExecutionLimits, ) (*result.ExecutionResult, error)
Execute runs a Git file operation (read or write) and returns an execution result.
func (*Connector) IntrospectSchema ¶
IntrospectSchema shallow-clones the repository and infers schema from files in BasePath.
type Credentials ¶
type Credentials struct {
AuthType AuthType `json:"auth_type" validate:"required,oneof=1 2"`
Username string `json:"username,omitempty"`
Token string `json:"token,omitempty"`
SSHPrivateKey string `json:"ssh_private_key,omitempty"`
SSHPassphrase string `json:"ssh_passphrase,omitempty"`
SSHKnownHosts string `json:"ssh_known_hosts,omitempty"`
}
Credentials holds Git authentication values.
type ProviderConfig ¶
type ProviderConfig struct {
Repository ProviderRepository `json:"repository" validate:"required"`
BasePath string `json:"base_path,omitempty"`
}
type ProviderRepository ¶
type QueryFormat ¶
type QueryFormat = filedata.QueryFormat
QueryFormat is an alias for filedata.QueryFormat.