config

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: May 13, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetSavedConnections

func GetSavedConnections() ([]connection.Connection, error)

GetSavedConnections retrieves all saved connection configurations from the configuration file.

func ReadFromFile

func ReadFromFile(key string) (connection.Connection, error)

ReadFromFile reads a ConnectionHistory object from the configuration file based on the provided key.

func WriteToFile

func WriteToFile(conf *ConnectionHistory) (int, error)

WriteToFile appends a ConnectionHistory object to a JSON file for persistent storage, ensuring that the file maintains an array of JSON objects.

If the file doesn't exist, it creates the file and initializes it with a JSON array containing the provided object. If the file already exists, it appends the JSON object to the existing array.

Types

type ConnectionHistory

type ConnectionHistory struct {
	Schema     string                `json:"key"`
	Connection connection.Connection `json:"connection"`
}

ConnectionHistory represents an object for storing connection information in a file. The 'Schema' field holds the schema name, which serves as the key for retrieving objects from the file later. The 'Connection' field contains the actual connection data.

func NewConnectionConfig

func NewConnectionConfig(key string, connection *connection.Connection) *ConnectionHistory

NewConnectionConfig creates a new ConnectionHistory object with the provided key and connection data.

Jump to

Keyboard shortcuts

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