sqlite3

package module
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2023 License: MIT Imports: 6 Imported by: 1

README

sqlite3

GoDoc Tesst Go Report Card codecov Gitter chat

SQLite3 adapter for REL.

Example

package main

import (
	"context"

	_ "github.com/mattn/go-sqlite3"
	"github.com/go-rel/sqlite3"
	"github.com/go-rel/rel"
)

func main() {
	// open sqlite3 connection.
	adapter, err := sqlite3.Open("dev.db")
	if err != nil {
		panic(err)
	}
	defer adapter.Close()

	// initialize rel's repo.
	repo := rel.New(adapter)
	repo.Ping(context.TODO())
}

Supported Driver

  • github.com/mattn/go-sqlite3

Documentation

Overview

Package sqlite3 wraps go-sqlite3 driver as an adapter for rel.

Usage:

// open sqlite3 connection.
adapter, err := sqlite3.Open("dev.db")
if err != nil {
	panic(err)
}
defer adapter.Close()

// initialize rel's repo.
repo := rel.New(adapter)

Index

Constants

View Source
const Name string = "sqlite3"

Name of database type this adapter implements.

Variables

This section is empty.

Functions

func MustOpen added in v0.11.0

func MustOpen(dsn string) rel.Adapter

MustOpen sqlite3 connection using dsn.

func New

func New(database *db.DB) rel.Adapter

New sqlite3 adapter using existing connection.

func Open

func Open(dsn string) (rel.Adapter, error)

Open sqlite3 connection using dsn.

Types

type SQLite3 added in v0.11.0

type SQLite3 struct {
	sql.SQL
}

SQLite3 adapter

func (SQLite3) Name added in v0.11.0

func (SQLite3) Name() string

Name of database adapter.

Jump to

Keyboard shortcuts

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