database

package
v1.18.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 19, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddListToCollection added in v1.10.0

func AddListToCollection(collectionId int, listId int) error

AddListToCollection adds a list to a collection

func AdminUserExists

func AdminUserExists() bool

func CollectionNameTaken added in v1.10.0

func CollectionNameTaken(userId int, name string) (bool, error)

CollectionNameTaken checks if a collection name already exists for a user

func CreateCollection added in v1.10.0

func CreateCollection(userId int, name string, description string) (int, error)

CreateCollection creates a new collection for a user

func CreateItem

func CreateItem(item constants.ItemInsert) error

func CreateList

func CreateList(userId int, name string, description string) (int, error)

func CreateOIDCUser added in v1.15.0

func CreateOIDCUser(email, name, provider, subject, oidcEmail string) (int, error)

CreateOIDCUser creates a new user with OIDC authentication

func CreateOrUpdateOIDCUser added in v1.15.0

func CreateOrUpdateOIDCUser(email, name, provider, subject, oidcEmail string) (int, error)

CreateOrUpdateOIDCUser creates a new OIDC user or updates existing one

func CreatePasswordResetToken added in v1.9.0

func CreatePasswordResetToken(email string) (string, error)

CreatePasswordResetToken generates a new reset token for the given email

func DeleteCollection added in v1.10.0

func DeleteCollection(collectionId int, confirmationName string) (bool, error)

DeleteCollection deletes a collection after confirming the name matches

func DeleteItem

func DeleteItem(itemId int) error

func DeleteList

func DeleteList(listId int, confirmationName string) (bool, error)

func DeleteUser added in v1.7.0

func DeleteUser(userId int) error

func GenerateCollectionShareCode added in v1.10.0

func GenerateCollectionShareCode(collectionId int) (string, error)

GenerateCollectionShareCode generates a unique share code for a collection and ensures all lists within the collection have share codes as well

func GenerateShareCode

func GenerateShareCode(listId int) (string, error)

func GetAllGroupAdmins added in v1.8.0

func GetAllGroupAdmins() ([]constants.UserRead, error)

func GetAllUsers

func GetAllUsers() ([]constants.UserRead, error)

func GetCollection added in v1.10.0

func GetCollection(collectionId int) (constants.Collection, error)

GetCollection retrieves a collection by its ID

func GetCollectionFromShareCode added in v1.10.0

func GetCollectionFromShareCode(shareCode string) (constants.Collection, error)

GetCollectionFromShareCode retrieves a collection by its share code

func GetCollectionListIds added in v1.10.0

func GetCollectionListIds(collectionId int) ([]uint64, error)

GetCollectionListIds retrieves all list ids in a collection

func GetCollectionLists added in v1.10.0

func GetCollectionLists(collectionId int) ([]constants.ListWithAuthor, error)

GetCollectionLists retrieves all lists in a collection with item counts and author information

func GetCollections added in v1.10.0

func GetCollections(userId int) ([]constants.Collection, error)

GetCollections retrieves all collections owned by a specific user

func GetGroupSharingEnabled added in v1.16.0

func GetGroupSharingEnabled(groupId int) (bool, error)

GetGroupSharingEnabled returns whether group sharing is enabled for a given group

func GetItem

func GetItem(itemId int) (constants.Item, error)

func GetList

func GetList(listId int) (constants.List, error)

func GetListFromShareCode

func GetListFromShareCode(shareCode string) (constants.List, error)

func GetListGroupSharing added in v1.16.0

func GetListGroupSharing(listId int) (shareWithGroup bool, groupCanEdit bool, err error)

GetListGroupSharing returns the group sharing settings for a list

func GetListIdsWithShareCode added in v1.10.0

func GetListIdsWithShareCode(userId int) ([]uint64, error)

GetListIdsWithShareCode retrieves all list IDs for a user that have share codes

func GetListItems

func GetListItems(listId int) ([]constants.Item, error)

func GetLists

func GetLists(userId int) ([]constants.List, error)

func GetListsSharedWithGroup added in v1.16.0

func GetListsSharedWithGroup(userId int) ([]constants.ListSharedWithGroup, error)

GetListsSharedWithGroup returns all lists shared with a user's group Returns list ID, list name, sharecode, owner user ID, owner name, and whether the group can edit

func GetNextAvailableGroupId added in v1.8.0

func GetNextAvailableGroupId() (int, error)

GetNextAvailableGroupId returns the next available group ID (max + 1)

func GetUser added in v1.17.0

func GetUser(userId int) (constants.UserRead, error)

GetUser returns user information by user ID

func GetUserByEmail added in v1.9.0

func GetUserByEmail(email string) (int, error)

GetUserByEmail returns the user ID if the email exists, -1 if not found

func GetUserByEmailForOIDCLinking added in v1.15.0

func GetUserByEmailForOIDCLinking(email string) (int, bool, error)

GetUserByEmailForOIDCLinking retrieves a user by email for OIDC account linking

func GetUserByOIDC added in v1.15.0

func GetUserByOIDC(provider, subject string) (int, error)

GetUserByOIDC retrieves a user by OIDC provider and subject

func GetUserGroupId added in v1.7.0

func GetUserGroupId(userId int) (int, error)

func GetUserOIDCInfo added in v1.15.0

func GetUserOIDCInfo(userID int) (string, string, string, error)

GetUserOIDCInfo retrieves OIDC information for a user

func GetUsersInSameGroupAsUser added in v1.7.0

func GetUsersInSameGroupAsUser(userId int) ([]constants.UserRead, error)

func InvalidatePasswordResetToken added in v1.9.0

func InvalidatePasswordResetToken(token string) error

InvalidatePasswordResetToken removes a token from the database

func LinkOIDCToExistingUser added in v1.15.0

func LinkOIDCToExistingUser(userID int, provider, subject, oidcEmail string) error

LinkOIDCToExistingUser links OIDC authentication to an existing user account

func ListInCollection added in v1.10.0

func ListInCollection(collectionId int, listId int) (bool, error)

ListInCollection checks if a list is already in a collection

func ListNameTaken

func ListNameTaken(userId int, name string) (bool, error)

func LoginUser

func LoginUser(email, password string) (int, error)

func RegisterUser

func RegisterUser(user constants.UserRegister) error

func RemoveListFromCollection added in v1.10.0

func RemoveListFromCollection(collectionId int, listId int) error

RemoveListFromCollection removes a list from a collection

func SetGroupSharingEnabled added in v1.16.0

func SetGroupSharingEnabled(groupId int, enabled bool) error

SetGroupSharingEnabled sets whether group sharing is enabled for a given group

func SetListGroupSharing added in v1.16.0

func SetListGroupSharing(listId int, shareWithGroup bool, groupCanEdit bool) error

SetListGroupSharing sets the group sharing settings for a list

func SetUserAdmin added in v1.7.0

func SetUserAdmin(userId int, admin bool) error

func SetUserInstanceAdmin added in v1.8.0

func SetUserInstanceAdmin(userId int, instanceAdmin bool) error

func UnlinkOIDCFromUser added in v1.15.0

func UnlinkOIDCFromUser(userID int) error

UnlinkOIDCFromUser removes OIDC authentication from a user account

func UnpublishCollectionShareCode added in v1.10.0

func UnpublishCollectionShareCode(collectionId int) error

UnpublishCollectionShareCode removes the share code from a collection

func UnpublishShareCode

func UnpublishShareCode(listId int) error

func UpdateCollection added in v1.10.0

func UpdateCollection(collectionId int, params constants.CollectionPostParams) error

UpdateCollection updates a collection's details

func UpdateItem

func UpdateItem(itemId int, item constants.ItemInsert) error

func UpdateList

func UpdateList(listId int, params constants.ListPostParams) error

func UpdateUserPassword added in v1.9.0

func UpdateUserPassword(email, newPassword string) error

UpdateUserPassword updates a user's password given their email

func UserCanEditList added in v1.16.0

func UserCanEditList(userId int, listId int) (bool, error)

UserCanEditList returns true if the user can edit the list This is true if the user owns the list OR if the list is shared with their group with edit permissions

func UserCanViewList added in v1.16.0

func UserCanViewList(userId int, listId int) (bool, error)

UserCanViewList returns true if the user can view the list This is true if the user owns the list OR if the list is shared with their group

func UserIsAdmin

func UserIsAdmin(userId int) (bool, error)

func UserIsInstanceAdmin added in v1.8.0

func UserIsInstanceAdmin(userId int) (bool, error)

func UserOwnsCollection added in v1.10.0

func UserOwnsCollection(userId int, collectionId int) (bool, error)

UserOwnsCollection checks if a user owns a specific collection

func UserOwnsList

func UserOwnsList(userId int, listId int) (bool, error)

func ValidatePasswordResetToken added in v1.9.0

func ValidatePasswordResetToken(token string) (string, bool, error)

ValidatePasswordResetToken checks if a token is valid and returns the associated email

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL