initializedb

package
v0.0.0-...-b989806 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package initializedb provides functionality for initializing a connection to ScyllaDB database using to gocql library.

Note: Make sure to handle errors appropriately when using this package.

Package initializedb provides functions for initializing a ScyllaDB connection and obtaining a database session.

Usage:

func main() {
    // Create a new ScyllaDB connection instance
    connection := initializedb.NewScyllaDBConnection(gocql.Quorum, "example_keyspace", "127.0.0.1")

    // Get a ScyllaDB session using the created connection
    session, err := initializedb.GetConnection(connection)
    if err != nil {
        log.Fatal("Failed to get ScyllaDB session:", err)
    }

    // Use the 'session' for database operations

    // Close the session when done
    defer session.Close()
}

This package includes functions for creating a new ScyllaDB connection and obtaining a ScyllaDB session. It utilizes the gocql library for interacting with ScyllaDB.

Functions:

  • NewScyllaDBConnection: Creates and returns a new instance of the 'scyllaDBConnection' type with the specified connection parameters. func NewScyllaDBConnection(consistency gocql.Consistency, keyspace string, hosts ...string) *scyllaDBConnection

  • GetConnection: Returns a ScyllaDB session using the provided 'scyllaDBConnection' instance. It internally creates a ScyllaDB cluster configuration and session. func GetConnection(conn *scyllaDBConnection) (scylladb.SessionxInterface, error)

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateKeySpace

func CreateKeySpace(consistency gocql.Consistency, keyspace string, hosts ...string) error

func RunMigrations

func RunMigrations(dbConn *ScyllaDBConnection, dir string) error

Types

type ScyllaDBConnection

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

func NewScyllaDBConnection

func NewScyllaDBConnection(consistency gocql.Consistency, keyspace string, hosts ...string) *ScyllaDBConnection

Jump to

Keyboard shortcuts

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