Skip to content

A Go library that provides access to SQLite metadata such as table, column and index information.

License

Notifications You must be signed in to change notification settings

deepilla/sqlitemeta

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

sqlitemeta

GoDoc Build Status Go Report Card

SQLitemeta is a Go library that provides access to SQLite metadata such as table, column and index information.

Installation

go get github.com/deepilla/sqlitemeta

Usage

Import the database/sql package along with an SQLite database driver.

import "database/sql"
import _ "github.com/mattn/go-sqlite3"

Import the sqlitemeta package.

import "github.com/deepilla/sqlitemeta"

Open a database connection and pass the handle to the sqlitemeta functions.

db, err := sql.Open("sqlite3", "/path/to/sqlite.db")
if err != nil {
    log.Fatal(err)
}
defer db.Close()

tables, err := sqlitemeta.TableNames(db)
if err != nil {
    log.Fatal(err)
}

for _, tbl := range tables {

    indexes, err := sqlitemeta.Indexes(db, tbl)
    if err != nil {
        log.Fatal(err)
    }

    fmt.Println("Table", tbl, "has the following indexes")
    for _, in := range indexes {
        fmt.Println(" -", in.Name)
    }
    fmt.Println()
}

Licensing

sqlitemeta is provided under an MIT License. See the LICENSE file for details.

About

A Go library that provides access to SQLite metadata such as table, column and index information.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages