Options
All
  • Public
  • Public/Protected
  • All
Menu

Class PermissionOverwriteCache

Cache used for saving overwrites of permissions belonging to channels

Hierarchy

  • BaseCache<PermissionOverwriteData>
    • PermissionOverwriteCache

Index

Methods

addToIndex

  • addToIndex(id: string, objectId?: string): Promise<void>
  • Add ids to the index of a namespace

    Parameters

    • id: string

      ids to add

    • objectId: string = ...

      id of the parent object of the index

    Returns Promise<void>

bindChannel

bindGuild

bindObject

  • bindObject(boundObject: Partial<PermissionOverwriteData>): void
  • Bind an object to the cache instance, you can read more on binding on the landing page of the documentation

    Parameters

    • boundObject: Partial<PermissionOverwriteData>

      Object to bind to this cache instance

    Returns void

buildId

  • buildId(permissionId: string, channelId?: string): string
  • Build a unique key for storing the data in the datasource

    Parameters

    • permissionId: string

      id of the permission overwrite

    • Optional channelId: string

      id of the channel that belongs to the permission overwrite

    Returns string

filter

  • filter(fn: (overwrite?: PermissionOverwriteData, index?: number, array?: PermissionOverwriteData[]) => unknown, channelId?: string, ids?: undefined | string[]): Promise<PermissionOverwriteCache[]>
  • Filter for permission overwrites by providing a filter function which returns true upon success and false otherwise

    Parameters

    • fn: (overwrite?: PermissionOverwriteData, index?: number, array?: PermissionOverwriteData[]) => unknown

      filter function to use for the filtering

        • (overwrite?: PermissionOverwriteData, index?: number, array?: PermissionOverwriteData[]): unknown
        • Parameters

          • Optional overwrite: PermissionOverwriteData
          • Optional index: number
          • Optional array: PermissionOverwriteData[]

          Returns unknown

    • channelId: string = ...

      id of the channel that belongs to the permission overwrite

    • ids: undefined | string[] = undefined

      Array of permission overwrite ids, if omitted the permission overwrite index will be used

    Returns Promise<PermissionOverwriteCache[]>

    returns an array of bound permission overwrite caches

find

  • find(fn: (overwrite?: PermissionOverwriteData, index?: number, array?: string[]) => unknown, channelId?: string, ids?: undefined | string[]): Promise<null | PermissionOverwriteCache>
  • Find a permission overwrite by providing a filter function which returns true upon success and false otherwise

    Parameters

    • fn: (overwrite?: PermissionOverwriteData, index?: number, array?: string[]) => unknown

      filter function to use for the filtering

        • (overwrite?: PermissionOverwriteData, index?: number, array?: string[]): unknown
        • Parameters

          • Optional overwrite: PermissionOverwriteData
          • Optional index: number
          • Optional array: string[]

          Returns unknown

    • channelId: string = ...

      id of the channel that belongs to the permission overwrite

    • ids: undefined | string[] = undefined

      Array of permission overwrite ids, if omitted the permission overwrite index will be used

    Returns Promise<null | PermissionOverwriteCache>

    returns a bound permission overwrite cache

get

  • Get a permission overwrite via id

    Parameters

    • id: string

      id of the permission overwrite

    • channelId: string = ...

      id of the channel that belongs to the permission overwrite

    Returns Promise<null | PermissionOverwriteCache>

    returns a bound permission overwrite cache or null if nothing was found

getIndexCount

  • getIndexCount(objectId?: string): Promise<number>
  • Get the number of elements that are within an index

    Parameters

    • objectId: string = ...

      id of the parent object of the index

    Returns Promise<number>

getIndexMembers

  • getIndexMembers(objectId?: string): Promise<string[]>
  • Get all members from an index

    Parameters

    • objectId: string = ...

      id of the parent object of the index

    Returns Promise<string[]>

isIndexed

  • isIndexed(id: string, objectId?: string): Promise<boolean>
  • Check if an id is a member of an index

    Parameters

    • id: string

      id to check

    • objectId: string = ...

      id of the parent object of the index

    Returns Promise<boolean>

    returns true if it is a part of the index, false otherwise

remove

  • remove(id: string, channelId?: string): Promise<void>
  • Remove a permission overwrite entry from the cache

    Parameters

    • id: string

      id of the permission overwrite

    • channelId: string = ...

      id of the channel that belongs to the permission overwrite

    Returns Promise<void>

removeFromIndex

  • removeFromIndex(id: string, objectId?: string): Promise<void>
  • Remove an id from the index

    Parameters

    • id: string

      id to be removed

    • objectId: string = ...

      id of the parent object of the index

    Returns Promise<void>

removeIndex

  • removeIndex(objectId?: string): Promise<void>
  • Delete an index

    Parameters

    • objectId: string = ...

      id of the parent object of the index

    Returns Promise<void>

structurize

  • structurize<D>(data: Partial<D>): Partial<D>
  • Delete keys from data if necessary based on RainCache structureDefs options and return the cleaned data

    Type parameters

    • D

    Parameters

    • data: Partial<D>

      The data to possibly delete object entries from

    Returns Partial<D>

update

  • Update a permission overwrite entry in the cache

    Parameters

    • id: string

      id of the permission overwrite

    • channelId: string = ...

      id of the channel that belongs to the permission overwrite

    • data: Partial<PermissionOverwriteData>

      updated permission overwrite data, will be merged with the old data

    Returns Promise<PermissionOverwriteCache>

    returns a bound permission overwrite cache

Properties

boundChannel

boundChannel: string = ""

Optional boundGuild

boundGuild?: string

guild id bound to this cache

boundObject

boundObject: null | Partial<PermissionOverwriteData> = null

dataTimestamp

dataTimestamp: null | Date = null

namespace

namespace: "permissionoverwrite" = "permissionoverwrite"

rain

rain: RainCache<any, any>

storageEngine

storageEngine: BaseStorageEngine<PermissionOverwriteData>

Constructors

constructor

  • Create a new PermissionOverwriteCache

    This class is automatically instantiated by RainCache

    Parameters

    • storageEngine: BaseStorageEngine<PermissionOverwriteData>

      Storage engine to use for this cache

    • rain: RainCache<any, any>
    • Optional boundObject: Partial<PermissionOverwriteData>

      Optional, may be used to bind a permission overwrite object to this cache

    Returns PermissionOverwriteCache

Generated using TypeDoc