attrs

package
v1.54.0 Latest Latest
Warning

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

Go to latest
Published: Sep 2, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Attribute

type Attribute struct {
	ID          int64               `db:"id"`
	Name        string              `db:"name"`
	ParentID    sql.NullInt64       `db:"parent_id"`
	Description sql.NullString      `db:"description"`
	TypeID      NullAttributeTypeID `db:"type_id"`
	UnitID      sql.NullInt64       `db:"unit_id"`
	Multiple    bool                `db:"multiple"`
	Precision   sql.NullInt32       `db:"precision"`
}

type AttributeType

type AttributeType struct {
	ID   AttributeTypeID `db:"id"`
	Name string          `db:"name"`
}

type AttributeTypeID

type AttributeTypeID int32
const (
	TypeUnknown AttributeTypeID = 0
	TypeString  AttributeTypeID = 1
	TypeInteger AttributeTypeID = 2
	TypeFloat   AttributeTypeID = 3
	TypeText    AttributeTypeID = 4
	TypeBoolean AttributeTypeID = 5
	TypeList    AttributeTypeID = 6
	TypeTree    AttributeTypeID = 7
)

type ListOption

type ListOption struct {
	ID          int64         `db:"id"`
	Name        string        `db:"name"`
	AttributeID int64         `db:"attribute_id"`
	ParentID    sql.NullInt64 `db:"parent_id"`
}

type NullAttributeTypeID

type NullAttributeTypeID struct {
	AttributeTypeID AttributeTypeID
	Valid           bool // Valid is true if AttributeTypeID is not NULL
}

func (*NullAttributeTypeID) Scan

func (n *NullAttributeTypeID) Scan(value any) error

Scan implements the Scanner interface.

func (NullAttributeTypeID) Value

func (n NullAttributeTypeID) Value() (driver.Value, error)

Value implements the driver Valuer interface.

type Repository

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

Repository Main Object.

func NewRepository

func NewRepository(
	db *goqu.Database,
) *Repository

NewRepository constructor.

func (*Repository) Attribute

func (s *Repository) Attribute(ctx context.Context, id int64) (bool, Attribute, error)

func (*Repository) AttributeTypes

func (s *Repository) AttributeTypes(ctx context.Context) ([]AttributeType, error)

func (*Repository) Attributes

func (s *Repository) Attributes(ctx context.Context, zoneID int64, parentID int64) ([]Attribute, error)

func (*Repository) ListOptions

func (s *Repository) ListOptions(ctx context.Context, attributeID int64) ([]ListOption, error)

func (*Repository) Units

func (s *Repository) Units(ctx context.Context) ([]Unit, error)

func (*Repository) ZoneAttributes

func (s *Repository) ZoneAttributes(ctx context.Context, zoneID int64) ([]ZoneAttribute, error)

func (*Repository) Zones

func (s *Repository) Zones(ctx context.Context) ([]Zone, error)

type Unit

type Unit struct {
	ID   int64  `db:"id"`
	Name string `db:"name"`
	Abbr string `db:"abbr"`
}

type Zone

type Zone struct {
	ID   int64  `db:"id"`
	Name string `db:"name"`
}

type ZoneAttribute

type ZoneAttribute struct {
	ZoneID      int64 `db:"zone_id"`
	AttributeID int64 `db:"attribute_id"`
}

Jump to

Keyboard shortcuts

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