cockroach

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jul 21, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package cockroach provides functionality for extracting database schema information from CockroachDB databases.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Source

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

Source represents a CockroachDB database source for schema extraction. It maintains a database connection and implements the dberd.SchemaExtractor interface to provide schema information from a CockroachDB instance.

func NewSource

func NewSource(connStr string) (*Source, error)

NewSource creates a new CockroachDB source from a connection string. It parses the connection string, establishes a database connection, and returns a new Source instance ready for schema extraction.

func NewSourceFromDB

func NewSourceFromDB(db *sql.DB) *Source

NewSourceFromDB creates a new CockroachDB source from an existing database connection. This is useful when you want to reuse an existing database connection for schema extraction purposes.

func (*Source) Close

func (s *Source) Close() error

Close closes the database connection if it was created by NewSource. If the connection was provided externally (via NewSourceFromDB), this is a no-op.

func (*Source) ExtractSchema

func (s *Source) ExtractSchema(ctx context.Context) (schema dberd.Schema, err error)

ExtractSchema extracts the complete database schema including tables and their references. It returns a dberd.Schema containing all tables and their relationships.

Jump to

Keyboard shortcuts

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