IIdentifiable

Interface used to create data objects that can be uniquely idendified by an ID.

Description

The IIdentifiable[K any] interface is used to create data objects that can be uniquely idendified by an ID.

Important points

  • The type specified in the interface defines the type of the ID field.

Fields

id

The unique object identifier.

Examples

type MyStruct struct {
	...
	id string
}
func (c *MyStruct) GetId() string {
	return c.id
}
func (c *MyStruct) SetId(id string) {
	c.id = id
}