-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(core/event): make
core/event
as a type alias of `schema/appdat…
…a` (#21719)
- Loading branch information
1 parent
a9f057b
commit 7856d22
Showing
5 changed files
with
15 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,24 @@ | ||
package event | ||
|
||
import "cosmossdk.io/schema/appdata" | ||
|
||
// Attribute is a kv-pair event attribute. | ||
type Attribute struct { | ||
Key, Value string | ||
} | ||
type Attribute = appdata.EventAttribute | ||
|
||
func NewAttribute(key, value string) Attribute { | ||
return Attribute{Key: key, Value: value} | ||
} | ||
|
||
// Events represents a list of events. | ||
type Events struct { | ||
Events []Event | ||
} | ||
type Events = appdata.EventData | ||
|
||
func NewEvents(events ...Event) Events { | ||
return Events{Events: events} | ||
} | ||
|
||
// Event defines how an event will emitted | ||
type Event struct { | ||
Type string | ||
Attributes []Attribute | ||
} | ||
type Event = appdata.Event | ||
|
||
func NewEvent(ty string, attrs ...Attribute) Event { | ||
return Event{Type: ty, Attributes: attrs} | ||
return Event{Type: ty, Attributes: func() ([]Attribute, error) { return attrs, nil }} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
cosmossdk.io/schema v0.2.0 h1:UH5CR1DqUq8yP+5Np8PbvG4YX0zAUsTN2Qk6yThmfMk= | ||
cosmossdk.io/schema v0.2.0/go.mod h1:RDAhxIeNB4bYqAlF4NBJwRrgtnciMcyyg0DOKnhNZQQ= |