sqlg

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrConcurrent = errors.New("concurrent update")

Functions

func ObjectNames

func ObjectNames(objectInfos []ObjectInfo) []string

Types

type ExportMeta

type ExportMeta struct {
	Kind string `json:"kind"`
}

type Initer

type Initer interface {
	Init() error
}

type MigrateFunc

type MigrateFunc func(tx *sql.Tx) error

type Object

type Object interface {
	GetID() string
}

type ObjectField

type ObjectField struct {
	Name     string
	ColName  string
	Type     string
	BaseType string
	SQLType  string
	Nullable bool
	Unique   bool
	Sequence bool
	JSON     bool
}

type ObjectInfo

type ObjectInfo struct {
	Name   string
	Table  string
	Fields []ObjectField
	// TODO(sgotti) instead of a pure ddl, use data to generate it
	Constraints []string
	// TODO(sgotti) instead of a pure ddl, use data to generate it
	Indexes []string
}

func PopulateObjectsInfo

func PopulateObjectsInfo(inObjectsInfo []ObjectInfo, dbType sql.Type) []ObjectInfo

func (ObjectInfo) PopulatePostgres

func (oi ObjectInfo) PopulatePostgres() ObjectInfo

func (ObjectInfo) PopulateSqlite3

func (oi ObjectInfo) PopulateSqlite3() ObjectInfo

type ObjectMeta

type ObjectMeta struct {
	// ID is the unique ID of the object.
	ID string `json:"id"`

	// CreationTime represents the time when this object has been created.
	CreationTime time.Time `json:"creationTime"`

	// UpdateTime represents the time when this object has been created/updated.
	UpdateTime time.Time `json:"updateTime"`

	// Revision is the object revision, it's not saved in the object but
	// populated by the fetch from the database
	Revision uint64 `json:"-"`

	// TxID is the current transaction id, used internally and must not be saved in the object
	TxID string `json:"-"`
}

func NewObjectMeta

func NewObjectMeta(tx *sql.Tx) ObjectMeta

func (*ObjectMeta) GetID

func (m *ObjectMeta) GetID() string

type PreJSONSetupper

type PreJSONSetupper interface {
	PreJSON() error
}

type Sequence added in v0.9.0

type Sequence struct {
	Name   string
	Table  string
	Column string
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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