forked from corestoreio/pkg
-
Notifications
You must be signed in to change notification settings - Fork 0
/
doc.go
103 lines (69 loc) · 3.48 KB
/
doc.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
// Copyright 2015-2016, Cyrill @ Schumacher.fm and the CoreStore contributors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/*
Package csfw contains the CoreStore library based on Magento's database structure.
99% compatible to Magento 1 and 2.
The package csfw contains at the moment only go:generate commands to build Go code.
Two skeleton projects (monolith and SOA) are already setup but of course empty.
Purpose
Why is someone trying to create a Magento database schema compatible online shop in Go?
Because performance :-)
Architecture
@todo 10km view.
Names
Generated SQL table structs start with the word "Table". The word "Slice" will
be appended when there is a slice of structs.
Example for generated SQL table structs:
type (
// TableStoreSlice contains pointers to TableStore types
TableStoreSlice []*TableStore
// TableStore a type for the MySQL table core_store
TableStore struct {
...
}
)
Table indexes are iota constants and start with TableIndex[table name].
The word "collection" will be appended to a variable or function when that variable or function contains
a materialized slice or handles it.
Event/Observer vs Publish/Subscribe
Basically those two are nearly the same. The only difference lies in its behaviour.
Event/Observer can modify a type and block an operation while Publish/Subscribe
runs asynchronously in its own Goroutine and cannot modify anything.
Required settings
CS_DSN the environment variable for the MySQL connection.
$ export CS_DSN='magento1:magento1@tcp(localhost:3306)/magento1'
$ export CS_DSN='magento2:magento2@tcp(localhost:3306)/magento2'
$ go get github.com/corestoreio/csfw
$ export CS_DSN_TEST='see next section'
$ cd $GOPATH/src/github.com/corestoreio/csfw
$ go generate ./...
Testing
Setup two databases. One for Magento 1 and one for Magento 2 and fill them with
the provided test data https://github.com/corestoreio/csfw/tree/master/testData
Create a DSN env var CS_DSN_TEST and point it to Magento 1 database. Run the tests.
Change the env var to let it point to Magento 2 database. Rerun the tests.
$ export CS_DSN_TEST='magento1:magento1@tcp(localhost:3306)/magento1'
$ export CS_DSN_TEST='magento2:magento2@tcp(localhost:3306)/magento2'
IDE
Currently using the IntelliJ IDEA Community Edition with the https://github.com/go-lang-plugin-org/go-lang-idea-plugin plugin.
At the moment Q2/2015: There are no official jar files for downloading so the go lang plugin will be
compiled on a daily basis. The plugin works very well! Kudos to those developers!
IDEA has been configured with goimports, gofmt, golint, govet and ... with the file watcher plugin.
Why am I not using vim? Because I would only generate passwords ;-|.
Contributing
Please have a look at the contribution guidelines https://github.com/corestoreio/corestore/blob/master/CONTRIBUTING.md
Trademarks
Magento is a trademark of MAGENTO, INC. http://www.magentocommerce.com/license/
*/
package csfw