Explore this module further in the Mover Registry: @sage/shared
Structs
Posts
A collection of Post
structs.
public struct Posts has store
posts: sui::table::Table<u64, address>
Functions
add
Add a Post
to the collection.
public fun add(posts: &mut Posts, post_timestamp: u64, post_address: address)
public fun add(
posts: &mut Posts,
post_timestamp: u64,
post_address: address
) {
posts.posts.add(
post_timestamp,
post_address
);
}
create
Create a new Posts
instance.
public fun create(ctx: &mut TxContext): Posts
public fun create(
ctx: &mut TxContext
): Posts {
Posts {
posts: table::new(ctx)
}
}
get_length
Get the total number of Post
s in the collection.
public fun get_length(posts: &Posts): u64
public fun get_length(
posts: &Posts
): u64 {
posts.posts.length()
}
has_record
Returns true or false based on whether a Post
exists at a timestamp.
public fun has_record(posts: &Posts, post_timestamp: u64): bool
public fun has_record(
posts: &Posts,
post_timestamp: u64
): bool {
posts.posts.contains(post_timestamp)
}