use sui::table;

Explore this module further in the Mover Registry: @sage/shared

Structs

Likes

All of the relationships that exist between Users and the content they have liked.

public struct Likes has store

Constants

Value used to store whether content has been liked or not.

const LIKE: u8 = 1;

Error code used when attempting to like content that has already been liked.

const EAlreadyLiked: u64 = 370;

Functions

add

Like the content.

public fun add(likes: &mut Likes, key: address)

assert_has_not_liked

Aborts with EAlreadyLiked if the content has already been liked.

public fun assert_has_not_liked(likes: &Likes, key: address)

create

Creates a new instance of Likes.

public fun create(ctx: &mut TxContext): Likes

get_length

Gets the number of times the content has been liked.

public fun get_length(likes: &Likes): u64

has_liked

Returns true or false based on whether the content has been liked.

public fun has_liked(likes: &Likes, key: address): bool