pub struct Create {
pub btl: u64,
pub data: Bytes,
pub string_annotations: Vec<StringAnnotation>,
pub numeric_annotations: Vec<NumericAnnotation>,
}Expand description
Type representing a create transaction in GolemBase. Used to define new entities, including their data, BTL, and annotations.
Fields§
§btl: u64The block-to-live (BTL) for the entity.
data: BytesThe data associated with the entity.
string_annotations: Vec<StringAnnotation>String annotations for the entity.
numeric_annotations: Vec<NumericAnnotation>Numeric annotations for the entity.
Implementations§
Source§impl Create
impl Create
Sourcepub fn new(payload: Vec<u8>, btl: u64) -> Self
pub fn new(payload: Vec<u8>, btl: u64) -> Self
Creates a new Create operation with empty annotations.
Accepts a payload as bytes and a BTL value.
Sourcepub fn from_string<T: Into<String>>(payload: T, btl: u64) -> Self
pub fn from_string<T: Into<String>>(payload: T, btl: u64) -> Self
Creates a new Create 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 Create 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 Create for chaining.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Create
impl<'de> Deserialize<'de> for Create
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 Create
impl RefUnwindSafe for Create
impl Send for Create
impl Sync for Create
impl Unpin for Create
impl UnsafeUnpin for Create
impl UnwindSafe for Create
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