pub struct Update {
pub entity_key: Hash,
pub btl: u64,
pub data: Bytes,
pub string_annotations: Vec<StringAnnotation>,
pub numeric_annotations: Vec<NumericAnnotation>,
}
Expand description
Type representing an update transaction in GolemBase. Used to update existing entities, including their data, BTL, and annotations.
Fields§
§entity_key: Hash
The key of the entity to update.
btl: u64
The updated block-to-live (BTL) for the entity.
data: Bytes
The updated data for the entity.
string_annotations: Vec<StringAnnotation>
Updated string annotations for the entity.
numeric_annotations: Vec<NumericAnnotation>
Updated numeric annotations for the entity.
Implementations§
Source§impl Update
impl Update
Sourcepub fn new(entity_key: B256, payload: Vec<u8>, btl: u64) -> Self
pub fn new(entity_key: B256, payload: Vec<u8>, btl: u64) -> Self
Creates a new Update
operation with empty annotations.
Accepts an entity key, payload as bytes, and a BTL value.
Sourcepub fn from_string<T: Into<String>>(
entity_key: B256,
payload: T,
btl: u64,
) -> Self
pub fn from_string<T: Into<String>>( entity_key: B256, payload: T, btl: u64, ) -> Self
Creates a new Update
request from any type that can be converted to String
.
Sourcepub fn annotate_string(
self,
key: impl Into<String>,
value: impl Into<String>,
) -> Self
pub fn annotate_string( self, key: impl Into<String>, value: impl Into<String>, ) -> Self
Adds a string annotation to the entity.
Returns the modified Update
for chaining.
Sourcepub fn annotate_number(self, key: impl Into<String>, value: u64) -> Self
pub fn annotate_number(self, key: impl Into<String>, value: u64) -> Self
Adds a numeric annotation to the entity.
Returns the modified Update
for chaining.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Update
impl<'de> Deserialize<'de> for Update
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl !Freeze for Update
impl RefUnwindSafe for Update
impl Send for Update
impl Sync for Update
impl Unpin for Update
impl UnwindSafe for Update
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more