Skip to content

Commit

Permalink
Merge pull request #51 from webability-go/late-night
Browse files Browse the repository at this point in the history
patch v1.0.1
  • Loading branch information
metalwolf committed Feb 10, 2020
2 parents 5c81985 + 74edc02 commit 89b4d50
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 10 deletions.
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,15 @@ XCache: activate persistant cache too (shared memory) ????? maybe not for go its
Version Changes Control
=======================

v1.0.1 - 2020-02-10
-----------------------
- Documentation corrections
- Bug on String() and GoString() corrected

v1.0.0 - 2020-02-09
-----------------------
- Version leveling
- Manual corrections
- Documentation corrections
- Change functions Stringify() by String() and GoString() for language compatibility
- Tests functions enhanced

Expand Down
9 changes: 5 additions & 4 deletions xcore.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@
// 2. Fill in the cache:
//
// Once you have declared the cache, you can fill it with anything you want. The main cache object is an interface{}
// so you can put here anything you need, from simple variables to complex structures. You need to use the Set funcion:
// so you can put here anything you need, from simple variables to complex structures. You need to use the Set function:
// Note the ID is always a string, so convert a database key to string if needed.
//
// func main() {
// myfiles.Set("https://developers.webability.info/", "somedata")
Expand Down Expand Up @@ -88,8 +89,8 @@
// When the source is distant (other cluster database, any rpc source on another network, integration of many parts, etc), it is more recommended to create a
// function that will delete the cache when needed (on demand cache change).
//
// The validator funcion is a func(id, time,Time) bool function. The first parameter is the ID entry in the cache, the second parameter the time of the entry was created.
// The validator funcion returns trul is the cache is still valid, or false if it needs to be invalidated.
// The validator function is a func(id, time.Time) bool function. The first parameter is the ID entry in the cache, the second parameter the time of the entry was created.
// The validator function returns true is the cache is still valid, or false if it needs to be invalidated.
//
// var myfiles = xcore.NewXCache("myfiles", 50, 0)
// myfiles.Validator = FileValidator
Expand Down Expand Up @@ -835,7 +836,7 @@
package xcore

// VERSION is the used version nombre of the XCore library.
const VERSION = "1.0.0"
const VERSION = "1.0.1"

// LOG is the flag to activate logging on the library.
// if LOG is set to TRUE, LOG indicates to the XCore libraries to log a trace of functions called, with most important parameters.
Expand Down
18 changes: 14 additions & 4 deletions xdataset.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,17 @@ type XDataset map[string]interface{}

// String will transform the XDataset into a readable string
func (d *XDataset) String() string {
return d.GoString()
str := "XDataset[\n"
for key, val := range *d {
str += " " + key + ": " + fmt.Sprint(val) + "\n"
}
str += "]\n"
return str
}

// GoString will transform the XDataset into a readable string for humans
func (d *XDataset) GoString() string {
return fmt.Sprintf("%+v\n", *d)
return d.String()
}

// Set will add a variable key with value data to the XDataset
Expand Down Expand Up @@ -435,12 +440,17 @@ type XDatasetCollection []XDatasetDef

// String will transform the XDataset into a readable string
func (d *XDatasetCollection) String() string {
return d.GoString()
str := "XDatasetCollection[\n"
for key, val := range *d {
str += " " + strconv.Itoa(key) + ": " + fmt.Sprint(val) + "\n"
}
str += "]\n"
return str
}

// GoString will transform the XDataset into a readable string for humans
func (d *XDatasetCollection) GoString() string {
return fmt.Sprintf("%+v\n", *d)
return d.String()
}

// Unshift will adds a XDatasetDef at the beginning of the collection
Expand Down
2 changes: 1 addition & 1 deletion xtemplate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ No hobbies
[[]]
`)
if err != nil {
t.Errorf(err)
t.Error(err)
}

tmp, _ := time.Parse(time.RFC3339, "2020-01-01T12:00:00")
Expand Down

0 comments on commit 89b4d50

Please sign in to comment.