property

package
v0.0.0-...-c2300e3 Latest Latest
Warning

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

Go to latest
Published: Dec 28, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotFound      = errors.New("property not found")
	ErrLimitExceeded = errors.New("max number of properties exceeded")
)
View Source
var (
	StatusCreated = Status{"CREATED"}
	StatusActive  = Status{"ACTIVE"}
	StatusDeleted = Status{"DELETED"}
)

Set of possible status for a user.

Functions

This section is empty.

Types

type Core

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

func NewCore

func NewCore(log *logger.Logger, store Storer) *Core

func (*Core) Create

func (c *Core) Create(ctx context.Context, core NewProperty) (Property, error)

func (*Core) Delete

func (c *Core) Delete(ctx context.Context, core Property) (Property, error)

func (*Core) ExecuteUnderTransaction

func (c *Core) ExecuteUnderTransaction(tx transaction.Transaction) (*Core, error)

ExecuteUnderTransaction constructs a new Core value that will use the specified transaction in any store related calls.

func (*Core) QueryByID

func (c *Core) QueryByID(ctx context.Context, id uuid.UUID) (Property, error)

func (*Core) QueryByManagerID

func (c *Core) QueryByManagerID(ctx context.Context, managerID uuid.UUID) ([]Property, error)

func (*Core) Update

func (c *Core) Update(ctx context.Context, o Property, n UpdateProperty) (Property, error)

type NewProperty

type NewProperty struct {
	ID              uuid.UUID
	ManagerID       uuid.UUID
	Name            string
	AddressLevel1ID uint32
	AddressLevel2ID uint32
	AddressLevel3ID uint32
	Street          string
	Status          Status
}

type Property

type Property struct {
	ID              uuid.UUID
	ManagerID       uuid.UUID
	Name            string
	AddressLevel1ID uint32
	AddressLevel2ID uint32
	AddressLevel3ID uint32
	Street          string
	Status          Status
	CreatedAt       time.Time
	UpdatedAt       time.Time
}

type Status

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

Status represents a user status in the system.

func MustParseStatus

func MustParseStatus(value string) Status

MustParseStatus parses the string value and returns a status if one exists. If an error occurs the function panics.

func ParseStatus

func ParseStatus(value string) (Status, error)

ParseStatus parses the string value and returns a status if one exists.

func (*Status) Equal

func (r *Status) Equal(r2 Status) bool

Equal provides support for the go-cmp package and testing.

func (*Status) MarshalText

func (r *Status) MarshalText() ([]byte, error)

MarshalText implement the marshal interface for JSON conversions.

func (*Status) Name

func (r *Status) Name() string

Name returns the name of the status.

func (*Status) UnmarshalText

func (r *Status) UnmarshalText(data []byte) error

UnmarshalText implement the unmarshal interface for JSON conversions.

type Storer

type Storer interface {
	Create(ctx context.Context, core Property) error
	Update(ctx context.Context, core Property) error
	QueryByID(ctx context.Context, id uuid.UUID) (Property, error)
	QueryByManagerID(ctx context.Context, id uuid.UUID) ([]Property, error)
	ExecuteUnderTransaction(tx transaction.Transaction) (Storer, error)
}

type UpdateProperty

type UpdateProperty struct {
	Name            *string
	AddressLevel1ID *uint32
	AddressLevel2ID *uint32
	AddressLevel3ID *uint32
	Street          *string
}

type UpdatePropertyStatus

type UpdatePropertyStatus struct {
	Status *Status
}

Directories

Path Synopsis
stores

Jump to

Keyboard shortcuts

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