database

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Host     string
	Port     string
	User     string
	Password string
	DBName   string
	SSLMode  string
}

Config holds database configuration

type PostgresDB

type PostgresDB struct {
	DB *sql.DB
}

func NewPostgresDB

func NewPostgresDB(config Config) (*PostgresDB, error)

NewPostgresDB creates a new PostgreSQL database connection

func (*PostgresDB) Close

func (p *PostgresDB) Close() error

Close closes the database connection

func (*PostgresDB) GetAllCSVData

func (p *PostgresDB) GetAllCSVData() ([]map[string]interface{}, error)

GetAllCSVData retrieves all CSV data from the database

func (*PostgresDB) GetCSVDataByID

func (p *PostgresDB) GetCSVDataByID(id int) (map[string]interface{}, error)

GetCSVDataByID retrieves CSV data by ID

func (*PostgresDB) InitSchema

func (p *PostgresDB) InitSchema() error

InitSchema creates the necessary tables if they don't exist

func (*PostgresDB) InsertCSVData

func (p *PostgresDB) InsertCSVData(filename string, records []map[string]string) error

InsertCSVData inserts CSV data (as JSON) into the database

Jump to

Keyboard shortcuts

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