dbx

package
v0.0.0-...-b985c77 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2024 License: AGPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CreateObjectParams

type CreateObjectParams struct {
	Name       string
	IsTemplate bool
	TemplateID uuid.NullUUID
}

type CreatePropertyParams

type CreatePropertyParams struct {
	ObjectID      uuid.UUID
	Name          string
	PropertyType  PropertyType
	StringValue   pgtype.Text
	IntegerValue  pgtype.Int8
	FloatValue    pgtype.Float8
	DateValue     pgtype.Date
	BooleanValue  pgtype.Bool
	ObjectValueID uuid.NullUUID
	ImagePath     pgtype.Text
	TemplateID    uuid.NullUUID
}

type CreateUserParams

type CreateUserParams struct {
	Name              string
	Email             string
	EncryptedPassword string
}

type DBTX

type DBTX interface {
	Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error)
	Query(context.Context, string, ...interface{}) (pgx.Rows, error)
	QueryRow(context.Context, string, ...interface{}) pgx.Row
}

type NullPropertyType

type NullPropertyType struct {
	PropertyType PropertyType
	Valid        bool // Valid is true if PropertyType is not NULL
}

func (*NullPropertyType) Scan

func (ns *NullPropertyType) Scan(value interface{}) error

Scan implements the Scanner interface.

func (NullPropertyType) Value

func (ns NullPropertyType) Value() (driver.Value, error)

Value implements the driver Valuer interface.

type Object

type Object struct {
	ID                uuid.UUID
	Name              string
	AlternateNamesCsv string
	IsTemplate        bool
	TemplateID        uuid.NullUUID
	CreatedAt         pgtype.Timestamp
	UpdatedAt         pgtype.Timestamp
}

type Property

type Property struct {
	ID            uuid.UUID
	Name          string
	ObjectID      uuid.UUID
	TemplateID    uuid.NullUUID
	PropertyType  PropertyType
	StringValue   pgtype.Text
	IntegerValue  pgtype.Int8
	FloatValue    pgtype.Float8
	ObjectValueID uuid.NullUUID
	DateValue     pgtype.Date
	BooleanValue  pgtype.Bool
	ImagePath     pgtype.Text
	CreatedAt     pgtype.Timestamp
	UpdatedAt     pgtype.Timestamp
}

type PropertyType

type PropertyType string
const (
	PropertyTypeString  PropertyType = "string"
	PropertyTypeInteger PropertyType = "integer"
	PropertyTypeFloat   PropertyType = "float"
	PropertyTypeBoolean PropertyType = "boolean"
	PropertyTypeObject  PropertyType = "object"
	PropertyTypeImage   PropertyType = "image"
	PropertyTypeDate    PropertyType = "date"
)

func (*PropertyType) Scan

func (e *PropertyType) Scan(src interface{}) error

type Queries

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

func New

func New(db DBTX) *Queries

func (*Queries) CreateObject

func (q *Queries) CreateObject(ctx context.Context, arg CreateObjectParams) (Object, error)

func (*Queries) CreateProperty

func (q *Queries) CreateProperty(ctx context.Context, arg CreatePropertyParams) (Property, error)

func (*Queries) CreateUser

func (q *Queries) CreateUser(ctx context.Context, arg CreateUserParams) (User, error)

func (*Queries) FetchObjectByID

func (q *Queries) FetchObjectByID(ctx context.Context, id uuid.UUID) (Object, error)

func (*Queries) FetchObjectsByID

func (q *Queries) FetchObjectsByID(ctx context.Context, ids []uuid.UUID) ([]Object, error)

func (*Queries) FetchPropertiesByObjectID

func (q *Queries) FetchPropertiesByObjectID(ctx context.Context, objectID uuid.UUID) ([]Property, error)

func (*Queries) FetchUserByEmail

func (q *Queries) FetchUserByEmail(ctx context.Context, email string) (User, error)

func (*Queries) WithTx

func (q *Queries) WithTx(tx pgx.Tx) *Queries

type SchemaMigration

type SchemaMigration struct {
	Version int64
	Dirty   bool
}

type User

type User struct {
	ID                uuid.UUID
	Name              string
	Email             string
	EncryptedPassword string
	CreatedAt         pgtype.Timestamp
	UpdatedAt         pgtype.Timestamp
}

Jump to

Keyboard shortcuts

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