sqlmap

package module
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2023 License: MIT Imports: 1 Imported by: 0

README

sqlmap

A small library that maps the results of Go's *sql.Rows to []map[string]any.

Install

go get github.com/devlights/sqlmap@latest

Usage

var (
    db  *sql.DB
    err error
)

db, _ := sql.Open("sqlite", "path/to/db")
defer db.Close()

var (
    rows *sql.Rows
)

rows, _ := db.Query("SELECT * FROM xxxxx")
defer rows.Close()

var (
    mapRows []map[string]any
)

mapRows, err := sqlmap.MapRows(rows)
if err != nil {
    return err
}

fmt.Println(mapRows)

Documentation

Overview

Package sqlmap is a small library that maps the results of Go's *sql.Rows to map[string]any.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MapRows

func MapRows(rows *sql.Rows) ([]map[string]any, error)

MapRows maps the data in the given *sql.Rows to []map[string]any.

This code is based on the ideas presented at the following URL:

Types

This section is empty.

Jump to

Keyboard shortcuts

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