func (f Uint64Field) Dec() (val uint64, err error) {
	val, err = f.Get()
	if err != nil {
		if errors.Is(err, leveldb.ErrNotFound) {
			val = 0
		} else {
			return 0, fmt.Errorf("get value: %w", err)
		}
	}
	if val != 0 {
		val--
	}
	return val, f.Put(val)
}
Dec decrements a uint64 value in the database.
This operation is not goroutine save.
The field is protected from overflow to a negative value.
package shed
import (
	"encoding/binary"
	"errors"
	"fmt"
	"github.com/syndtr/goleveldb/leveldb"
)
type Uint64Field struct {
	db  *DB
	key []byte
}
func (db *DB) NewUint64Field(name string) (f Uint64Field, err error) {
	key, err := db.schemaFieldKey(name, "uint64")
	if err != nil {
		return f, fmt.Errorf("get schema key: %w", err)
	}
	return Uint64Field{
		db:  db,
		key: key,
	}, nil
}
func (f Uint64Field) Get() (val uint64, err error) {
	b, err := f.db.Get(f.key)
	if err != nil {
		if errors.Is(err, leveldb.ErrNotFound) {
			return 0, nil
		}
		return 0, err
	}
	return binary.BigEndian.Uint64(b), nil
}
func (f Uint64Field) Put(val uint64) (err error) {
	return f.db.Put(f.key, encodeUint64(val))
}
func (f Uint64Field) PutInBatch(batch *leveldb.Batch, val uint64) {
	batch.Put(f.key, encodeUint64(val))
}
func (f Uint64Field) Inc() (val uint64, err error) {
	val, err = f.Get()
	if err != nil {
		if errors.Is(err, leveldb.ErrNotFound) {
			val = 0
		} else {
			return 0, fmt.Errorf("get value: %w", err)
		}
	}
	val++
	return val, f.Put(val)
}
func (f Uint64Field) IncInBatch(batch *leveldb.Batch) (val uint64, err error) {
	val, err = f.Get()
	if err != nil {
		if errors.Is(err, leveldb.ErrNotFound) {
			val = 0
		} else {
			return 0, fmt.Errorf("get value: %w", err)
		}
	}
	val++
	f.PutInBatch(batch, val)
	return val, nil
}