Skip to content

v0.1.0 - Dec 11, 2016

Compare
Choose a tag to compare
@kirsle kirsle released this 12 Dec 00:00
· 40 commits to master since this release

This update changes some function prototypes in the API which breaks backward
compatibility with existing code.

  • API Breaking Changes:
    • rivescript.New() now takes a *config.Config struct to configure the
      instance. This is now the preferred way to configure debug mode, strict
      mode, UTF-8, etc. rather than functions like SetUTF8().

      For RiveScript's default settings, you can do rivescript.New(config.Basic())
      or rivescript.New(nil). For UTF-8 support, rivescript.New(config.UTF8())
      is a convenient config template to use.

    • GetDepth() and SetDepth() now use a uint instead of an int. But
      these functions are deprecated anyway.

    • GetUservars() and GetAllUservars() return *sessions.UserData objects
      instead of map[string]string for the user data.

    • ThawUservars() now takes a sessions.ThawAction instead of a string to
      specify the action. Valid values are Thaw, Discard, or Keep
      (constants from the sessions package).

  • Deprecated Functions:
    • Configuration functions (getters and setters). Use the Config struct
      when calling rivescript.New(*config.Config) instead:
      • SetDebug(), SetUTF8(), SetDepth(), SetStrict()
      • GetDebug(), GetUTF8(), GetDepth(), GetStrict()
  • Changes:
    • Add support for pluggable session stores for user variables. The default
      one still keeps user variables in memory, but you can specify your own
      implementation instead.

      The interface for a SessionManager is in the sessions package. The
      default in-memory manager is in sessions/memory. By implementing your own
      session manager, you can change where RiveScript keeps track of user
      variables, e.g. to put them in a database or cache.

    • Make the library thread-safe with regards to getting/setting user variables
      while answering a message. The default in-memory session manager implements
      a mutex for accessing user variables.