v0.1.0 - Dec 11, 2016
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 likeSetUTF8()
.For RiveScript's default settings, you can do
rivescript.New(config.Basic())
orrivescript.New(nil)
. For UTF-8 support,rivescript.New(config.UTF8())
is a convenient config template to use. -
GetDepth()
andSetDepth()
now use auint
instead of anint
. But
these functions are deprecated anyway. -
GetUservars()
andGetAllUservars()
return*sessions.UserData
objects
instead ofmap[string]string
for the user data. -
ThawUservars()
now takes asessions.ThawAction
instead of a string to
specify the action. Valid values areThaw
,Discard
, orKeep
(constants from thesessions
package).
-
- Deprecated Functions:
- Configuration functions (getters and setters). Use the
Config
struct
when callingrivescript.New(*config.Config)
instead:SetDebug()
,SetUTF8()
,SetDepth()
,SetStrict()
GetDebug()
,GetUTF8()
,GetDepth()
,GetStrict()
- Configuration functions (getters and setters). Use the
- 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 thesessions
package. The
default in-memory manager is insessions/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.
-