assettypes

package
v0.0.0-...-da65c41 Latest Latest
Warning

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

Go to latest
Published: Sep 13, 2023 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Book = assets.AssetType{
	Tag:         "book",
	Label:       "Book",
	Description: "Book",

	Props: []assets.AssetProp{
		{

			Required: true,
			IsKey:    true,
			Tag:      "title",
			Label:    "Book Title",
			DataType: "string",
			Writers:  []string{`org2MSP`, "orgMSP"},
		},
		{

			Required: true,
			IsKey:    true,
			Tag:      "author",
			Label:    "Book Author",
			DataType: "string",
			Writers:  []string{`org2MSP`, "orgMSP"},
		},
		{

			Tag:      "currentTenant",
			Label:    "Current Tenant",
			DataType: "->person",
		},
		{

			Tag:      "genres",
			Label:    "Genres",
			DataType: "[]string",
		},
		{

			Tag:      "published",
			Label:    "Publishment Date",
			DataType: "datetime",
		},
		{

			Tag:      "bookType",
			Label:    "Book Type",
			DataType: "bookType",
		},
	},
}

Description of a book

View Source
var CustomAssets = []assets.AssetType{}

CustomAssets contains all assets inserted via GoFabric's Template mode. For local development, this can be empty or could contain assets that are supposed to be defined via the Template mode.

View Source
var DynamicAssetTypes = assets.DynamicAssetType{
	Enabled:     true,
	AssetAdmins: []string{`org1MSP`, "orgMSP"},
}

DynamicAssetTypes contains the configuration for the Dynamic AssetTypes feature.

View Source
var Library = assets.AssetType{
	Tag:         "library",
	Label:       "Library",
	Description: "Library as a collection of books",

	Props: []assets.AssetProp{
		{

			Required: true,
			IsKey:    true,
			Tag:      "name",
			Label:    "Library Name",
			DataType: "string",
			Writers:  []string{`org3MSP`, "orgMSP"},
		},
		{

			Tag:      "books",
			Label:    "Book Collection",
			DataType: "[]->book",
		},
		{

			Tag:      "entranceCode",
			Label:    "Entrance Code for the Library",
			DataType: "->secret",
		},
	},
}

Description of a Library as a collection of books

View Source
var Person = assets.AssetType{
	Tag:         "person",
	Label:       "Person",
	Description: "Personal data of someone",

	Props: []assets.AssetProp{
		{

			Required: true,
			IsKey:    true,
			Tag:      "id",
			Label:    "CPF (Brazilian ID)",
			DataType: "cpf",
			Writers:  []string{`org1MSP`, "orgMSP"},
		},
		{

			Required: true,
			Tag:      "name",
			Label:    "Name of the person",
			DataType: "string",

			Validate: func(name interface{}) error {
				nameStr := name.(string)
				if nameStr == "" {
					return fmt.Errorf("name must be non-empty")
				}
				return nil
			},
		},
		{

			Tag:      "dateOfBirth",
			Label:    "Date of Birth",
			DataType: "datetime",
		},
		{

			Tag:          "height",
			Label:        "Person's height",
			DefaultValue: 0,
			DataType:     "number",
		},
	},
}
View Source
var Secret = assets.AssetType{
	Tag:         "secret",
	Label:       "Secret",
	Description: "Secret between Org2 and Org3",

	Readers: []string{"org2MSP", "org3MSP", "orgMSP"},
	Props: []assets.AssetProp{
		{

			IsKey:    true,
			Tag:      "secretName",
			Label:    "Secret Name",
			DataType: "string",
			Writers:  []string{`org2MSP`, "orgMSP"},
		},
		{

			Required: true,
			Tag:      "secret",
			Label:    "Secret",
			DataType: "string",
		},
	},
}

Secret is and information available only for org2 and org3 Collections.json configuration is necessary

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

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