Skip to content

Commit

Permalink
Merge pull request #52 from webability-go/late-night
Browse files Browse the repository at this point in the history
v1.1.0
  • Loading branch information
metalwolf committed Mar 12, 2020
2 parents 89b4d50 + 8df559c commit 7719a91
Show file tree
Hide file tree
Showing 21 changed files with 819 additions and 398 deletions.
40 changes: 15 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
[![GoDoc](https://godoc.org/github.com/webability-go/xcore?status.png)](https://godoc.org/github.com/webability-go/xcore)
[![GolangCI](https://golangci.com/badges/github.com/webability-go/xcore.svg)](https://golangci.com)

XCore for GO v0
XCore for GO v1
=============================

The XCore package is used to build basic object for programmtion. for the WebAbility compatility code
The XCore package is used to build basic object for programmation. for the WebAbility compatility code
For GO, the actual existing code includes:
- XCache: Application Memory Caches
- XDataset: Basic nested data structures for any purpose (template injection, configuration files, database records, etc)
Expand All @@ -19,18 +19,28 @@ Manuals are available on godoc.org [![GoDoc](https://godoc.org/github.com/webabi

TO DO:
======
- Implement Logging with import "log"
- XTemplate must concatenate strings after compilation
- Implements functions as data entry for template Execute (simple data or loop functions, can get backs anything, creates an interface)
- template.Print beautify, check stringify
- language.Print beautify, check stringify
- Some improvements to check, later:
Adds mutex on XLanguage, XDataset, XTemplate ?? (they should be used locally on every thread, or not ??), maybe adds a flag "thread safe" ?
XCache: activate persistant cache too (shared memory) ????? maybe not for go itself, but for instance to talk with other memory data used by other languages and apps, or to not loose the caches if the app is restarted.


Version Changes Control
=======================

v1.1.0 - 2020-03-01
-----------------------
- Modularization of XCore
- XLanguage tests and examples are now conform to Go test units
- Implementation of XLanguage.String and XLanguage.GoString, removed Print
- XCache tests and examples are now conform to Go test units
- XDataset tests and examples are now conform to Go test units
- Implementation of XDataset.String and XDataset.GoString, removed Print
- Implementation of XDatasetCollection.String and XDatasetCollection.GoString, removed Print
- XTemplate tests and examples are now conform to Go test units
- Implementation of XTemplate.String and XTemplate.GoString, removed Print

v1.0.1 - 2020-02-10
-----------------------
- Documentation corrections
Expand Down Expand Up @@ -147,23 +157,3 @@ V0.0.2 - 2018-12-17
V0.0.1 - 2018-11-14
-----------------------
- First basic commit with XLanguage object created


XLanguage:

Example:

```
lang, err := xcore.NewXLanguageFromXMLString(`
<?xml version="1.0" encoding="UTF-8"?>
<language id="language-demo" lang="en">
<entry id="entry1">Welcome to</entry>
<entry id="entry2">XCore</entry>
</language>
`)
tr1 = lang.Get("entry1")
tr2 = lang.Get("entry2")
fmt.Println(tr1, tr2)
```
5 changes: 5 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module github.com/webability-go/xcore

go 1.14

require golang.org/x/text v0.3.2
3 changes: 3 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
golang.org/x/text v0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs=
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
5 changes: 5 additions & 0 deletions testunit/a.en.language
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<language id="language-demo" lang="en">
<entry id="entry1">Welcome to</entry>
<entry id="entry2">XCore</entry>
</language>
5 changes: 5 additions & 0 deletions testunit/a.es.language
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<language id="language-demo" lang="es">
<entry id="entry1">Bienvenido a</entry>
<entry id="entry2">XCore</entry>
</language>
5 changes: 5 additions & 0 deletions testunit/a.fr.language
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<language id="language-demo" lang="fr">
<entry id="entry1">Bienvenue à</entry>
<entry id="entry2">XCore</entry>
</language>
10 changes: 10 additions & 0 deletions testunit/a.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@

%-- This is a comment. It will not appear in the final code. This files is LF coded, not CRLF, as the string in test (unix end of line) --%
Let's put your name here: {{clientname}}<br />
And lets put your hobbies here:<br />
%-- note the 1rst id is the entry into the data to inject and the second one is the name of the sub-template to use --%
@@hobbies:hobby@@
%-- And you need the template for each hobby:--%
[[hobby]]
I love {{name}}<br />
[[]]
37 changes: 37 additions & 0 deletions testunit/b.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
&&header&&
&&body&&

[[header]]
Sports shop:
[[]]

[[body]]
{{clientname}} Preferred hobby:
&&:preferredhobby>sport:sport.&& %-- will build sport_ + [yes/no] contained into the sport field. Be sure you have a template for each value ! --%

??preferredhobby>sport:sport??

[[sport.yes]]{{preferredhobby>name}} - It's a sport, sell him things![[]]
[[sport.no]]{{preferredhobby>name}} - It's not a sport, recommend him next store.[[]]
[[sport]]{{preferredhobby>name}} - We do not know that it is.[[]]

@@hobbies:hobby@@
[[hobby.first]]
1. {{name}} {{sport}}
[[]]
[[hobby.last]]
last. {{name}} {{sport}}
[[]]
[[hobby.even]]
2x. {{name}} {{sport}}
[[]]
[[hobby.key.3]]
3. {{name}} {{sport}}
[[]]
[[hobby]]
{{name}} {{sport}}
[[]]
[[hobby.none]]
No hobbies
[[]]
[[]]
3 changes: 3 additions & 0 deletions testunit/errors.es.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
panicerror=Error crítico del sistema
systemerror=Error del sistema
fileerror=Error leyendo el archivo
6 changes: 6 additions & 0 deletions testunit/errors.es.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<language id="errors" lang="es">
<entry id="panicerror">Error crítico del sistema</entry>
<entry id="systemerror">Error del sistema</entry>
<entry id="fileerror">Error leyendo el archivo</entry>
</language>
104 changes: 0 additions & 104 deletions testunit/xcore_xcache_test.go

This file was deleted.

63 changes: 0 additions & 63 deletions testunit/xcore_xdataset_test.go

This file was deleted.

63 changes: 0 additions & 63 deletions testunit/xcore_xlanguage_test.go

This file was deleted.

0 comments on commit 7719a91

Please sign in to comment.