# store Package

This page lists the `core/store` functions for opening a store, writing values, and reading or scanning keys.

## Lifecycle and Sessions

```go
func New(dir string, apiKey ...string) (*Store, error)
func (s *Store) Session() *Session
func (s *Store) Close() error
```

`Store` and `Session` both embed the unexported `core`, so every method below is available on both.

```go
func (c *core) Current() int
func (c *core) Select(index int) error
func (c *core) HasEmbedder() bool
func (c *core) Exec(input string) string
```

## Writes

```go
type SetFlag int
const (
    SetDefault SetFlag = iota
    SetNX
    SetXX
)

func (c *core) Set(key, value string, flag SetFlag, expireAt *int64) error
func (c *core) SetVector(ctx context.Context, key, value string, flag SetFlag, expireAt *int64) error
func (c *core) SetField(key string, subKeys []string, value string, flag SetFlag, expireAt *int64) error
func (c *core) Incr(key string, delta float64) (float64, error)
func (c *core) IncrField(key string, subKeys []string, delta float64) (float64, error)
func (c *core) Del(keys ...string) int
func (c *core) DelField(key string, subKeys []string) error
```

## Reads and Scans

```go
func (c *core) Get(key string) (*Entry, bool)
func (c *core) GetField(key string, subKeys []string) (string, bool)
func (c *core) Exist(key string) string
func (c *core) ExistField(key string, subKeys []string) string
func (c *core) Type(key string) string
func (c *core) TypeField(key string, subKeys []string) string
func (c *core) Keys(pattern string) []string
func (c *core) Find(op filter.Operator, value string, limit int) []string
func (c *core) Query(f filter.Filter, limit int) []string
```

`Exist`, `ExistField`, `Type`, and `TypeField` return the REPL text forms. `Query` returns `key: value` strings. `limit <= 0` means no limit.

## Related Pages

- [store Types](/api-reference-store-types)
- [Core Concepts](/core-concepts)
- [Quick Start: Embedded](/getting-started-embedded)
