gormstore

package module
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2025 License: MIT Imports: 3 Imported by: 0

README

GORM backend for libtnb session

Use:

import "github.com/libtnb/gormstore"

Documentation

https://pkg.go.dev/github.com/libtnb/gormstore?tab=doc

Example

// initialize and setup cleanup
store := gormstore.New(gorm.Open(...))

For more details see gormstore documentation.

Testing

Just sqlite3 tests:

go test

All databases using docker:

./test

If docker is not local (docker-machine etc):

DOCKER_IP=$(docker-machine ip dev) ./test

License

gormstore is licensed under the MIT license. See LICENSE for the full license text.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(db *gorm.DB) driver.Driver

New creates a new gormstore session

func NewOptions

func NewOptions(db *gorm.DB, opts Options) driver.Driver

NewOptions creates a new gormstore session with options

Types

type Options

type Options struct {
	TableName       string
	SkipCreateTable bool
}

Options for gormstore

type Store

type Store struct {
	// contains filtered or unexported fields
}

Store represent a gormstore

func (*Store) Close

func (st *Store) Close() error

func (*Store) Destroy

func (st *Store) Destroy(id string) error

func (*Store) Gc

func (st *Store) Gc(maxLifetime int) error

func (*Store) Read

func (st *Store) Read(id string) (string, error)

func (*Store) Write

func (st *Store) Write(id string, data string) error

Jump to

Keyboard shortcuts

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