Skip to content

command to create an indexed type #783

@lumtis

Description

@lumtis

Create a command for Starport to scaffold an indexed type.

The current type command creates a quantitative type indexed by an auto-incremented id but many use cases require a type that is indexed by a specific index (address in many cases for example).

The command would look like:

starport indexed-type <name> <field1> ... [--module ...] [--no-setter]

The type is always indexed by a string to have something generic.

Txs are scaffolded:

appd tx foo set-bar <index> <value1> ...
appd tx foo delete-bar <index>

Queries:

appd q foo get-bar <index>

The same as --no-crud planned for the type command, --no-setter would skip generating the txs to set a value from messages (could be called --no-crud as well for consistency but here Create and Edit are the same)

At the keeper level, methods generated are:

SetBar()
GetBar()
RemoveBar()
IterateBar()

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions