sqlite

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Jun 18, 2025 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type SQLite

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

SQLite implements the Datastore interface

func New

func New(dbPath string) (*SQLite, error)

New creates a new SQLite instance

func (*SQLite) Add

func (ds *SQLite) Add(ctx context.Context, entity datastore.Entity) error

Add inserts a record

func (*SQLite) BatchAdd

func (ds *SQLite) BatchAdd(ctx context.Context, entities []datastore.Entity) error

BatchAdd inserts multiple records

func (*SQLite) Commit

func (ds *SQLite) Commit(ctx context.Context) error

Commit commits the transaction

func (*SQLite) Count

func (ds *SQLite) Count(ctx context.Context, entity datastore.Entity, options *datastore.FilterOptions) (int64, error)

Count counts the number of records

func (*SQLite) Delete

func (ds *SQLite) Delete(ctx context.Context, entity datastore.Entity) error

Delete removes a record

func (*SQLite) Get

func (ds *SQLite) Get(ctx context.Context, entity datastore.Entity) error

Get retrieves a single record

func (*SQLite) Init

func (ds *SQLite) Init() error

Init TODO 这里需要考虑表结构变动的情况

func (*SQLite) IsExist

func (ds *SQLite) IsExist(ctx context.Context, entity datastore.Entity) (bool, error)

IsExist checks if a record exists

func (*SQLite) List

func (ds *SQLite) List(ctx context.Context, entity datastore.Entity, options *datastore.ListOptions) ([]datastore.Entity, error)

List queries multiple records

func (*SQLite) Put

func (ds *SQLite) Put(ctx context.Context, entity datastore.Entity) error

Put updates or inserts a record

Jump to

Keyboard shortcuts

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