724137e6 by astaxie

Merge branch 'master' into develop

2 parents 05089be4 a1447695
Showing 143 changed files with 1382 additions and 639 deletions
...@@ -2,9 +2,7 @@ ...@@ -2,9 +2,7 @@
2 2
3 [![Build Status](https://drone.io/github.com/astaxie/beego/status.png)](https://drone.io/github.com/astaxie/beego/latest) 3 [![Build Status](https://drone.io/github.com/astaxie/beego/status.png)](https://drone.io/github.com/astaxie/beego/latest)
4 4
5 beego is a Go Framework inspired by tornado and sinatra. 5 beego is an open-source, high-performance, modularity, full-stack web framework.
6
7 It is a simple & powerful web framework.
8 6
9 More info [beego.me](http://beego.me) 7 More info [beego.me](http://beego.me)
10 8
...@@ -12,20 +10,18 @@ More info [beego.me](http://beego.me) ...@@ -12,20 +10,18 @@ More info [beego.me](http://beego.me)
12 10
13 * RESTful support 11 * RESTful support
14 * MVC architecture 12 * MVC architecture
15 * Session support (store in memory, file, Redis or MySQL) 13 * modularity
16 * Cache support (store in memory, Redis or Memcache) 14 * auto API documents
17 * Global Config 15 * annotation router
18 * Intelligent routing 16 * namespace
19 * Thread-safe map 17 * powerful develop tools
20 * Friendly displaying of errors 18 * full stack for web & API
21 * Useful template functions
22
23 19
24 ## Documentation 20 ## Documentation
25 21
26 [English](http://beego.me/docs/intro/) 22 [English](http://beego.me/docs/intro/)
27 23
28 [API](http://gowalker.org/github.com/astaxie/beego) 24 [API](http://godoc.org/github.com/astaxie/beego)
29 25
30 [中文文档](http://beego.me/docs/intro/) 26 [中文文档](http://beego.me/docs/intro/)
31 27
......
1 // Beego (http://beego.me/) 1 // Copyright 2014 beego Author. All Rights Reserved.
2 // 2 //
3 // @description beego is an open-source, high-performance web framework for the Go programming language. 3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
4 // 6 //
5 // @link http://github.com/astaxie/beego for the canonical source repository 7 // http://www.apache.org/licenses/LICENSE-2.0
6 // 8 //
7 // @license http://github.com/astaxie/beego/blob/master/LICENSE 9 // Unless required by applicable law or agreed to in writing, software
8 // 10 // distributed under the License is distributed on an "AS IS" BASIS,
9 // @authors astaxie 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14
10 package beego 15 package beego
11 16
12 import ( 17 import (
......
1 // Beego (http://beego.me/) 1 // Copyright 2014 beego Author. All Rights Reserved.
2 // 2 //
3 // @description beego is an open-source, high-performance web framework for the Go programming language. 3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
4 // 6 //
5 // @link http://github.com/astaxie/beego for the canonical source repository 7 // http://www.apache.org/licenses/LICENSE-2.0
6 // 8 //
7 // @license http://github.com/astaxie/beego/blob/master/LICENSE 9 // Unless required by applicable law or agreed to in writing, software
8 // 10 // distributed under the License is distributed on an "AS IS" BASIS,
9 // @authors astaxie 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14
10 package beego 15 package beego
11 16
12 var indexTpl = ` 17 var indexTpl = `
......
1 // Beego (http://beego.me/) 1 // Copyright 2014 beego Author. All Rights Reserved.
2 // 2 //
3 // @description beego is an open-source, high-performance web framework for the Go programming language. 3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
4 // 6 //
5 // @link http://github.com/astaxie/beego for the canonical source repository 7 // http://www.apache.org/licenses/LICENSE-2.0
6 // 8 //
7 // @license http://github.com/astaxie/beego/blob/master/LICENSE 9 // Unless required by applicable law or agreed to in writing, software
8 // 10 // distributed under the License is distributed on an "AS IS" BASIS,
9 // @authors astaxie 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14
10 package beego 15 package beego
11 16
12 import ( 17 import (
......
1 // Beego (http://beego.me/) 1 // Copyright 2014 beego Author. All Rights Reserved.
2 // 2 //
3 // @description beego is an open-source, high-performance web framework for the Go programming language. 3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
4 // 6 //
5 // @link http://github.com/astaxie/beego for the canonical source repository 7 // http://www.apache.org/licenses/LICENSE-2.0
6 // 8 //
7 // @license http://github.com/astaxie/beego/blob/master/LICENSE 9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14
15 // beego is an open-source, high-performance, modularity, full-stack web framework
16 //
17 // package main
18 //
19 // import "github.com/astaxie/beego"
20 //
21 // func main() {
22 // beego.Run()
23 // }
8 // 24 //
9 // @authors astaxie 25 // more infomation: http://beego.me
10 package beego 26 package beego
11 27
12 import ( 28 import (
......
1 // Beego (http://beego.me/) 1 // Copyright 2014 beego Author. All Rights Reserved.
2 // 2 //
3 // @description beego is an open-source, high-performance web framework for the Go programming language. 3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
4 // 6 //
5 // @link http://github.com/astaxie/beego for the canonical source repository 7 // http://www.apache.org/licenses/LICENSE-2.0
6 // 8 //
7 // @license http://github.com/astaxie/beego/blob/master/LICENSE 9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14
15 // Usage:
16 //
17 // import(
18 // "github.com/astaxie/beego/cache"
19 // )
20 //
21 // bm, err := cache.NewCache("memory", `{"interval":60}`)
22 //
23 // Use it like this:
24 //
25 // bm.Put("astaxie", 1, 10)
26 // bm.Get("astaxie")
27 // bm.IsExist("astaxie")
28 // bm.Delete("astaxie")
8 // 29 //
9 // @authors astaxie 30 // more docs http://beego.me/docs/module/cache.md
10 package cache 31 package cache
11 32
12 import ( 33 import (
......
1 // Beego (http://beego.me/) 1 // Copyright 2014 beego Author. All Rights Reserved.
2 // 2 //
3 // @description beego is an open-source, high-performance web framework for the Go programming language. 3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
4 // 6 //
5 // @link http://github.com/astaxie/beego for the canonical source repository 7 // http://www.apache.org/licenses/LICENSE-2.0
6 // 8 //
7 // @license http://github.com/astaxie/beego/blob/master/LICENSE 9 // Unless required by applicable law or agreed to in writing, software
8 // 10 // distributed under the License is distributed on an "AS IS" BASIS,
9 // @authors astaxie 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14
10 package cache 15 package cache
11 16
12 import ( 17 import (
......
1 // Beego (http://beego.me/) 1 // Copyright 2014 beego Author. All Rights Reserved.
2 // 2 //
3 // @description beego is an open-source, high-performance web framework for the Go programming language. 3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
4 // 6 //
5 // @link http://github.com/astaxie/beego for the canonical source repository 7 // http://www.apache.org/licenses/LICENSE-2.0
6 // 8 //
7 // @license http://github.com/astaxie/beego/blob/master/LICENSE 9 // Unless required by applicable law or agreed to in writing, software
8 // 10 // distributed under the License is distributed on an "AS IS" BASIS,
9 // @authors astaxie 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14
10 package cache 15 package cache
11 16
12 import ( 17 import (
......
1 // Beego (http://beego.me/) 1 // Copyright 2014 beego Author. All Rights Reserved.
2 // 2 //
3 // @description beego is an open-source, high-performance web framework for the Go programming language. 3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
4 // 6 //
5 // @link http://github.com/astaxie/beego for the canonical source repository 7 // http://www.apache.org/licenses/LICENSE-2.0
6 // 8 //
7 // @license http://github.com/astaxie/beego/blob/master/LICENSE 9 // Unless required by applicable law or agreed to in writing, software
8 // 10 // distributed under the License is distributed on an "AS IS" BASIS,
9 // @authors astaxie 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14
10 package cache 15 package cache
11 16
12 import ( 17 import (
......
1 // Beego (http://beego.me/) 1 // Copyright 2014 beego Author. All Rights Reserved.
2 // 2 //
3 // @description beego is an open-source, high-performance web framework for the Go programming language. 3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
4 // 6 //
5 // @link http://github.com/astaxie/beego for the canonical source repository 7 // http://www.apache.org/licenses/LICENSE-2.0
6 // 8 //
7 // @license http://github.com/astaxie/beego/blob/master/LICENSE 9 // Unless required by applicable law or agreed to in writing, software
8 // 10 // distributed under the License is distributed on an "AS IS" BASIS,
9 // @authors astaxie 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14
10 package cache 15 package cache
11 16
12 import ( 17 import (
......
1 // Beego (http://beego.me/) 1 // Copyright 2014 beego Author. All Rights Reserved.
2 // 2 //
3 // @description beego is an open-source, high-performance web framework for the Go programming language. 3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
4 // 6 //
5 // @link http://github.com/astaxie/beego for the canonical source repository 7 // http://www.apache.org/licenses/LICENSE-2.0
6 // 8 //
7 // @license http://github.com/astaxie/beego/blob/master/LICENSE 9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14
15 // package memcahe for cache provider
16 //
17 // depend on github.com/bradfitz/gomemcache/memcache
18 //
19 // go install github.com/bradfitz/gomemcache/memcache
20 //
21 // Usage:
22 // import(
23 // _ "github.com/astaxie/beego/cache/memcache"
24 // "github.com/astaxie/beego/cache"
25 // )
26 //
27 // bm, err := cache.NewCache("memcache", `{"conn":"127.0.0.1:11211"}`)
8 // 28 //
9 // @authors astaxie 29 // more docs http://beego.me/docs/module/cache.md
10 package memcache 30 package memcache
11 31
12 import ( 32 import (
......
1 // Beego (http://beego.me/) 1 // Copyright 2014 beego Author. All Rights Reserved.
2 // 2 //
3 // @description beego is an open-source, high-performance web framework for the Go programming language. 3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
4 // 6 //
5 // @link http://github.com/astaxie/beego for the canonical source repository 7 // http://www.apache.org/licenses/LICENSE-2.0
6 // 8 //
7 // @license http://github.com/astaxie/beego/blob/master/LICENSE 9 // Unless required by applicable law or agreed to in writing, software
8 // 10 // distributed under the License is distributed on an "AS IS" BASIS,
9 // @authors astaxie 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14
10 package cache 15 package cache
11 16
12 import ( 17 import (
......
1 // Beego (http://beego.me/) 1 // Copyright 2014 beego Author. All Rights Reserved.
2 // 2 //
3 // @description beego is an open-source, high-performance web framework for the Go programming language. 3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
4 // 6 //
5 // @link http://github.com/astaxie/beego for the canonical source repository 7 // http://www.apache.org/licenses/LICENSE-2.0
6 // 8 //
7 // @license http://github.com/astaxie/beego/blob/master/LICENSE 9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14
15 // package redis for cache provider
16 //
17 // depend on github.com/garyburd/redigo/redis
18 //
19 // go install github.com/garyburd/redigo/redis
20 //
21 // Usage:
22 // import(
23 // _ "github.com/astaxie/beego/cache/redis"
24 // "github.com/astaxie/beego/cache"
25 // )
26 //
27 // bm, err := cache.NewCache("redis", `{"conn":"127.0.0.1:11211"}`)
8 // 28 //
9 // @authors astaxie 29 // more docs http://beego.me/docs/module/cache.md
10 package redis 30 package redis
11 31
12 import ( 32 import (
......
1 // Beego (http://beego.me/) 1 // Copyright 2014 beego Author. All Rights Reserved.
2 2 //
3 // @description beego is an open-source, high-performance web framework for the Go programming language. 3 // Licensed under the Apache License, Version 2.0 (the "License");
4 4 // you may not use this file except in compliance with the License.
5 // @link http://github.com/astaxie/beego for the canonical source repository 5 // You may obtain a copy of the License at
6 6 //
7 // @license http://github.com/astaxie/beego/blob/master/LICENSE 7 // http://www.apache.org/licenses/LICENSE-2.0
8 8 //
9 // @authors astaxie 9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
10 14
11 package redis 15 package redis
12 16
......
1 // Beego (http://beego.me/) 1 // Copyright 2014 beego Author. All Rights Reserved.
2 // 2 //
3 // @description beego is an open-source, high-performance web framework for the Go programming language. 3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
4 // 6 //
5 // @link http://github.com/astaxie/beego for the canonical source repository 7 // http://www.apache.org/licenses/LICENSE-2.0
6 // 8 //
7 // @license http://github.com/astaxie/beego/blob/master/LICENSE 9 // Unless required by applicable law or agreed to in writing, software
8 // 10 // distributed under the License is distributed on an "AS IS" BASIS,
9 // @authors astaxie 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14
10 package beego 15 package beego
11 16
12 import ( 17 import (
......
1 // Beego (http://beego.me/) 1 // Copyright 2014 beego Author. All Rights Reserved.
2 // 2 //
3 // @description beego is an open-source, high-performance web framework for the Go programming language. 3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
4 // 6 //
5 // @link http://github.com/astaxie/beego for the canonical source repository 7 // http://www.apache.org/licenses/LICENSE-2.0
6 // 8 //
7 // @license http://github.com/astaxie/beego/blob/master/LICENSE 9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14
15 // Usage:
16 // import(
17 // "github.com/astaxie/beego/config"
18 // )
19 //
20 // cnf, err := config.NewConfig("ini", "config.conf")
21 //
22 // cnf APIS:
23 //
24 // cnf.Set(key, val string) error
25 // cnf.String(key string) string
26 // cnf.Strings(key string) []string
27 // cnf.Int(key string) (int, error)
28 // cnf.Int64(key string) (int64, error)
29 // cnf.Bool(key string) (bool, error)
30 // cnf.Float(key string) (float64, error)
31 // cnf.DefaultString(key string, defaultval string) string
32 // cnf.DefaultStrings(key string, defaultval []string) []string
33 // cnf.DefaultInt(key string, defaultval int) int
34 // cnf.DefaultInt64(key string, defaultval int64) int64
35 // cnf.DefaultBool(key string, defaultval bool) bool
36 // cnf.DefaultFloat(key string, defaultval float64) float64
37 // cnf.DIY(key string) (interface{}, error)
38 // cnf.GetSection(section string) (map[string]string, error)
39 // cnf.SaveConfigFile(filename string) error
8 // 40 //
9 // @authors astaxie 41 // more docs http://beego.me/docs/module/config.md
10 package config 42 package config
11 43
12 import ( 44 import (
......
1 // Beego (http://beego.me/) 1 // Copyright 2014 beego Author. All Rights Reserved.
2 // 2 //
3 // @description beego is an open-source, high-performance web framework for the Go programming language. 3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
4 // 6 //
5 // @link http://github.com/astaxie/beego for the canonical source repository 7 // http://www.apache.org/licenses/LICENSE-2.0
6 // 8 //
7 // @license http://github.com/astaxie/beego/blob/master/LICENSE 9 // Unless required by applicable law or agreed to in writing, software
8 // 10 // distributed under the License is distributed on an "AS IS" BASIS,
9 // @authors astaxie 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14
10 package config 15 package config
11 16
12 import ( 17 import (
......
1 // Beego (http://beego.me/) 1 // Copyright 2014 beego Author. All Rights Reserved.
2 // 2 //
3 // @description beego is an open-source, high-performance web framework for the Go programming language. 3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
4 // 6 //
5 // @link http://github.com/astaxie/beego for the canonical source repository 7 // http://www.apache.org/licenses/LICENSE-2.0
6 // 8 //
7 // @license http://github.com/astaxie/beego/blob/master/LICENSE 9 // Unless required by applicable law or agreed to in writing, software
8 // 10 // distributed under the License is distributed on an "AS IS" BASIS,
9 // @authors astaxie 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14
10 package config 15 package config
11 16
12 import ( 17 import (
......
1 // Beego (http://beego.me/) 1 // Copyright 2014 beego Author. All Rights Reserved.
2 // 2 //
3 // @description beego is an open-source, high-performance web framework for the Go programming language. 3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
4 // 6 //
5 // @link http://github.com/astaxie/beego for the canonical source repository 7 // http://www.apache.org/licenses/LICENSE-2.0
6 // 8 //
7 // @license http://github.com/astaxie/beego/blob/master/LICENSE 9 // Unless required by applicable law or agreed to in writing, software
8 // 10 // distributed under the License is distributed on an "AS IS" BASIS,
9 // @authors astaxie 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14
10 package config 15 package config
11 16
12 import ( 17 import (
......
1 // Beego (http://beego.me/) 1 // Copyright 2014 beego Author. All Rights Reserved.
2 // 2 //
3 // @description beego is an open-source, high-performance web framework for the Go programming language. 3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
4 // 6 //
5 // @link http://github.com/astaxie/beego for the canonical source repository 7 // http://www.apache.org/licenses/LICENSE-2.0
6 // 8 //
7 // @license http://github.com/astaxie/beego/blob/master/LICENSE 9 // Unless required by applicable law or agreed to in writing, software
8 // 10 // distributed under the License is distributed on an "AS IS" BASIS,
9 // @authors astaxie 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14
10 package config 15 package config
11 16
12 import ( 17 import (
......
1 // Beego (http://beego.me/) 1 // Copyright 2014 beego Author. All Rights Reserved.
2 // 2 //
3 // @description beego is an open-source, high-performance web framework for the Go programming language. 3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
4 // 6 //
5 // @link http://github.com/astaxie/beego for the canonical source repository 7 // http://www.apache.org/licenses/LICENSE-2.0
6 // 8 //
7 // @license http://github.com/astaxie/beego/blob/master/LICENSE 9 // Unless required by applicable law or agreed to in writing, software
8 // 10 // distributed under the License is distributed on an "AS IS" BASIS,
9 // @authors astaxie 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14
10 package config 15 package config
11 16
12 import ( 17 import (
......
1 // Beego (http://beego.me/) 1 // Copyright 2014 beego Author. All Rights Reserved.
2 // 2 //
3 // @description beego is an open-source, high-performance web framework for the Go programming language. 3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
4 // 6 //
5 // @link http://github.com/astaxie/beego for the canonical source repository 7 // http://www.apache.org/licenses/LICENSE-2.0
6 // 8 //
7 // @license http://github.com/astaxie/beego/blob/master/LICENSE 9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14
15 // package xml for config provider
16 //
17 // depend on github.com/beego/x2j
18 //
19 // go install github.com/beego/x2j
20 //
21 // Usage:
22 // import(
23 // _ "github.com/astaxie/beego/config/xml"
24 // "github.com/astaxie/beego/config"
25 // )
26 //
27 // cnf, err := config.NewConfig("xml", "config.xml")
8 // 28 //
9 // @authors astaxie 29 // more docs http://beego.me/docs/module/config.md
10 package xml 30 package xml
11 31
12 import ( 32 import (
......
1 // Beego (http://beego.me/) 1 // Copyright 2014 beego Author. All Rights Reserved.
2 // 2 //
3 // @description beego is an open-source, high-performance web framework for the Go programming language. 3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
4 // 6 //
5 // @link http://github.com/astaxie/beego for the canonical source repository 7 // http://www.apache.org/licenses/LICENSE-2.0
6 // 8 //
7 // @license http://github.com/astaxie/beego/blob/master/LICENSE 9 // Unless required by applicable law or agreed to in writing, software
8 // 10 // distributed under the License is distributed on an "AS IS" BASIS,
9 // @authors astaxie 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14
10 package xml 15 package xml
11 16
12 import ( 17 import (
......
1 // Beego (http://beego.me/) 1 // Copyright 2014 beego Author. All Rights Reserved.
2 // 2 //
3 // @description beego is an open-source, high-performance web framework for the Go programming language. 3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
4 // 6 //
5 // @link http://github.com/astaxie/beego for the canonical source repository 7 // http://www.apache.org/licenses/LICENSE-2.0
6 // 8 //
7 // @license http://github.com/astaxie/beego/blob/master/LICENSE 9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14
15 // package yaml for config provider
16 //
17 // depend on github.com/beego/goyaml2
18 //
19 // go install github.com/beego/goyaml2
20 //
21 // Usage:
22 // import(
23 // _ "github.com/astaxie/beego/config/yaml"
24 // "github.com/astaxie/beego/config"
25 // )
26 //
27 // cnf, err := config.NewConfig("yaml", "config.yaml")
8 // 28 //
9 // @authors astaxie 29 // more docs http://beego.me/docs/module/config.md
10 package yaml 30 package yaml
11 31
12 import ( 32 import (
......
1 // Beego (http://beego.me/) 1 // Copyright 2014 beego Author. All Rights Reserved.
2 // 2 //
3 // @description beego is an open-source, high-performance web framework for the Go programming language. 3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
4 // 6 //
5 // @link http://github.com/astaxie/beego for the canonical source repository 7 // http://www.apache.org/licenses/LICENSE-2.0
6 // 8 //
7 // @license http://github.com/astaxie/beego/blob/master/LICENSE 9 // Unless required by applicable law or agreed to in writing, software
8 // 10 // distributed under the License is distributed on an "AS IS" BASIS,
9 // @authors astaxie 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14
10 package yaml 15 package yaml
11 16
12 import ( 17 import (
......
1 // Beego (http://beego.me/) 1 // Copyright 2014 beego Author. All Rights Reserved.
2 // 2 //
3 // @description beego is an open-source, high-performance web framework for the Go programming language. 3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
4 // 6 //
5 // @link http://github.com/astaxie/beego for the canonical source repository 7 // http://www.apache.org/licenses/LICENSE-2.0
6 // 8 //
7 // @license http://github.com/astaxie/beego/blob/master/LICENSE 9 // Unless required by applicable law or agreed to in writing, software
8 // 10 // distributed under the License is distributed on an "AS IS" BASIS,
9 // @authors astaxie 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14
10 package beego 15 package beego
11 16
12 import ( 17 import (
......
1 // Beego (http://beego.me/) 1 // Copyright 2014 beego Author. All Rights Reserved.
2 // 2 //
3 // @description beego is an open-source, high-performance web framework for the Go programming language. 3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
4 // 6 //
5 // @link http://github.com/astaxie/beego for the canonical source repository 7 // http://www.apache.org/licenses/LICENSE-2.0
6 // 8 //
7 // @license http://github.com/astaxie/beego/blob/master/LICENSE 9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14
15 // Usage:
16 //
17 // import "github.com/astaxie/beego/context"
18 //
19 // ctx := context.Context{Request:req,ResponseWriter:rw}
8 // 20 //
9 // @authors astaxie 21 // more docs http://beego.me/docs/module/context.md
10 package context 22 package context
11 23
12 import ( 24 import (
......
1 // Beego (http://beego.me/) 1 // Copyright 2014 beego Author. All Rights Reserved.
2 // 2 //
3 // @description beego is an open-source, high-performance web framework for the Go programming language. 3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
4 // 6 //
5 // @link http://github.com/astaxie/beego for the canonical source repository 7 // http://www.apache.org/licenses/LICENSE-2.0
6 // 8 //
7 // @license http://github.com/astaxie/beego/blob/master/LICENSE 9 // Unless required by applicable law or agreed to in writing, software
8 // 10 // distributed under the License is distributed on an "AS IS" BASIS,
9 // @authors astaxie 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14
10 package context 15 package context
11 16
12 import ( 17 import (
......
1 // Beego (http://beego.me/) 1 // Copyright 2014 beego Author. All Rights Reserved.
2 // 2 //
3 // @description beego is an open-source, high-performance web framework for the Go programming language. 3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
4 // 6 //
5 // @link http://github.com/astaxie/beego for the canonical source repository 7 // http://www.apache.org/licenses/LICENSE-2.0
6 // 8 //
7 // @license http://github.com/astaxie/beego/blob/master/LICENSE 9 // Unless required by applicable law or agreed to in writing, software
8 // 10 // distributed under the License is distributed on an "AS IS" BASIS,
9 // @authors astaxie 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14
10 package context 15 package context
11 16
12 import ( 17 import (
......
1 // Beego (http://beego.me/) 1 // Copyright 2014 beego Author. All Rights Reserved.
2 // 2 //
3 // @description beego is an open-source, high-performance web framework for the Go programming language. 3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
4 // 6 //
5 // @link http://github.com/astaxie/beego for the canonical source repository 7 // http://www.apache.org/licenses/LICENSE-2.0
6 // 8 //
7 // @license http://github.com/astaxie/beego/blob/master/LICENSE 9 // Unless required by applicable law or agreed to in writing, software
8 // 10 // distributed under the License is distributed on an "AS IS" BASIS,
9 // @authors astaxie 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14
10 package context 15 package context
11 16
12 import ( 17 import (
......
1 // Beego (http://beego.me/) 1 // Copyright 2014 beego Author. All Rights Reserved.
2 // 2 //
3 // @description beego is an open-source, high-performance web framework for the Go programming language. 3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
4 // 6 //
5 // @link http://github.com/astaxie/beego for the canonical source repository 7 // http://www.apache.org/licenses/LICENSE-2.0
6 // 8 //
7 // @license http://github.com/astaxie/beego/blob/master/LICENSE 9 // Unless required by applicable law or agreed to in writing, software
8 // 10 // distributed under the License is distributed on an "AS IS" BASIS,
9 // @authors astaxie 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14
10 package beego 15 package beego
11 16
12 import ( 17 import (
......
1 // Beego (http://beego.me/) 1 // Copyright 2014 beego Author. All Rights Reserved.
2 // 2 //
3 // @description beego is an open-source, high-performance web framework for the Go programming language. 3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
4 // 6 //
5 // @link http://github.com/astaxie/beego for the canonical source repository 7 // http://www.apache.org/licenses/LICENSE-2.0
6 // 8 //
7 // @license http://github.com/astaxie/beego/blob/master/LICENSE 9 // Unless required by applicable law or agreed to in writing, software
8 // 10 // distributed under the License is distributed on an "AS IS" BASIS,
9 // @authors astaxie 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14
10 package beego 15 package beego
11 16
12 import ( 17 import (
......
1 // Beego (http://beego.me/) 1 // Copyright 2014 beego Author. All Rights Reserved.
2 // 2 //
3 // @description beego is an open-source, high-performance web framework for the Go programming language. 3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
4 // 6 //
5 // @link http://github.com/astaxie/beego for the canonical source repository 7 // http://www.apache.org/licenses/LICENSE-2.0
6 // 8 //
7 // @license http://github.com/astaxie/beego/blob/master/LICENSE 9 // Unless required by applicable law or agreed to in writing, software
8 // 10 // distributed under the License is distributed on an "AS IS" BASIS,
9 // @authors astaxie 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14
10 package beego 15 package beego
11 16
12 // FilterRouter defines filter operation before controller handler execution. 17 // FilterRouter defines filter operation before controller handler execution.
......
1 // Beego (http://beego.me/) 1 // Copyright 2014 beego Author. All Rights Reserved.
2 // 2 //
3 // @description beego is an open-source, high-performance web framework for the Go programming language. 3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
4 // 6 //
5 // @link http://github.com/astaxie/beego for the canonical source repository 7 // http://www.apache.org/licenses/LICENSE-2.0
6 // 8 //
7 // @license http://github.com/astaxie/beego/blob/master/LICENSE 9 // Unless required by applicable law or agreed to in writing, software
8 // 10 // distributed under the License is distributed on an "AS IS" BASIS,
9 // @authors astaxie 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14
10 package beego 15 package beego
11 16
12 import ( 17 import (
......
1 // Beego (http://beego.me/) 1 // Copyright 2014 beego Author. All Rights Reserved.
2 // 2 //
3 // @description beego is an open-source, high-performance web framework for the Go programming language. 3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
4 // 6 //
5 // @link http://github.com/astaxie/beego for the canonical source repository 7 // http://www.apache.org/licenses/LICENSE-2.0
6 // 8 //
7 // @license http://github.com/astaxie/beego/blob/master/LICENSE 9 // Unless required by applicable law or agreed to in writing, software
8 // 10 // distributed under the License is distributed on an "AS IS" BASIS,
9 // @authors astaxie 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14
10 package beego 15 package beego
11 16
12 import ( 17 import (
......
1 // Beego (http://beego.me/) 1 // Copyright 2014 beego Author. All Rights Reserved.
2 // 2 //
3 // @description beego is an open-source, high-performance web framework for the Go programming language. 3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
4 // 6 //
5 // @link http://github.com/astaxie/beego for the canonical source repository 7 // http://www.apache.org/licenses/LICENSE-2.0
6 // 8 //
7 // @license http://github.com/astaxie/beego/blob/master/LICENSE 9 // Unless required by applicable law or agreed to in writing, software
8 // 10 // distributed under the License is distributed on an "AS IS" BASIS,
9 // @authors astaxie 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14
10 package beego 15 package beego
11 16
12 import ( 17 import (
......
1 // Beego (http://beego.me/) 1 // Copyright 2014 beego Author. All Rights Reserved.
2 // 2 //
3 // @description beego is an open-source, high-performance web framework for the Go programming language. 3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
4 // 6 //
5 // @link http://github.com/astaxie/beego for the canonical source repository 7 // http://www.apache.org/licenses/LICENSE-2.0
6 // 8 //
7 // @license http://github.com/astaxie/beego/blob/master/LICENSE 9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14
15 // Usage:
16 //
17 // import "github.com/astaxie/beego/context"
18 //
19 // b:=httplib.Post("http://beego.me/")
20 // b.Param("username","astaxie")
21 // b.Param("password","123456")
22 // b.PostFile("uploadfile1", "httplib.pdf")
23 // b.PostFile("uploadfile2", "httplib.txt")
24 // str, err := b.String()
25 // if err != nil {
26 // t.Fatal(err)
27 // }
28 // fmt.Println(str)
8 // 29 //
9 // @authors astaxie 30 // more docs http://beego.me/docs/module/httplib.md
10 package httplib 31 package httplib
11 32
12 import ( 33 import (
......
1 // Beego (http://beego.me/) 1 // Copyright 2014 beego Author. All Rights Reserved.
2 // 2 //
3 // @description beego is an open-source, high-performance web framework for the Go programming language. 3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
4 // 6 //
5 // @link http://github.com/astaxie/beego for the canonical source repository 7 // http://www.apache.org/licenses/LICENSE-2.0
6 // 8 //
7 // @license http://github.com/astaxie/beego/blob/master/LICENSE 9 // Unless required by applicable law or agreed to in writing, software
8 // 10 // distributed under the License is distributed on an "AS IS" BASIS,
9 // @authors astaxie 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14
10 package httplib 15 package httplib
11 16
12 import ( 17 import (
......
1 // Beego (http://beego.me/) 1 // Copyright 2014 beego Author. All Rights Reserved.
2 // 2 //
3 // @description beego is an open-source, high-performance web framework for the Go programming language. 3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
4 // 6 //
5 // @link http://github.com/astaxie/beego for the canonical source repository 7 // http://www.apache.org/licenses/LICENSE-2.0
6 // 8 //
7 // @license http://github.com/astaxie/beego/blob/master/LICENSE 9 // Unless required by applicable law or agreed to in writing, software
8 // 10 // distributed under the License is distributed on an "AS IS" BASIS,
9 // @authors astaxie 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14
10 package beego 15 package beego
11 16
12 import ( 17 import (
......
1 // Beego (http://beego.me/) 1 // Copyright 2014 beego Author. All Rights Reserved.
2 // 2 //
3 // @description beego is an open-source, high-performance web framework for the Go programming language. 3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
4 // 6 //
5 // @link http://github.com/astaxie/beego for the canonical source repository 7 // http://www.apache.org/licenses/LICENSE-2.0
6 // 8 //
7 // @license http://github.com/astaxie/beego/blob/master/LICENSE 9 // Unless required by applicable law or agreed to in writing, software
8 // 10 // distributed under the License is distributed on an "AS IS" BASIS,
9 // @authors astaxie 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14
10 package logs 15 package logs
11 16
12 import ( 17 import (
......
1 // Beego (http://beego.me/) 1 // Copyright 2014 beego Author. All Rights Reserved.
2 // 2 //
3 // @description beego is an open-source, high-performance web framework for the Go programming language. 3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
4 // 6 //
5 // @link http://github.com/astaxie/beego for the canonical source repository 7 // http://www.apache.org/licenses/LICENSE-2.0
6 // 8 //
7 // @license http://github.com/astaxie/beego/blob/master/LICENSE 9 // Unless required by applicable law or agreed to in writing, software
8 // 10 // distributed under the License is distributed on an "AS IS" BASIS,
9 // @authors astaxie 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14
10 package logs 15 package logs
11 16
12 import ( 17 import (
......
1 // Beego (http://beego.me/) 1 // Copyright 2014 beego Author. All Rights Reserved.
2 // 2 //
3 // @description beego is an open-source, high-performance web framework for the Go programming language. 3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
4 // 6 //
5 // @link http://github.com/astaxie/beego for the canonical source repository 7 // http://www.apache.org/licenses/LICENSE-2.0
6 // 8 //
7 // @license http://github.com/astaxie/beego/blob/master/LICENSE 9 // Unless required by applicable law or agreed to in writing, software
8 // 10 // distributed under the License is distributed on an "AS IS" BASIS,
9 // @authors astaxie 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14
10 package logs 15 package logs
11 16
12 import ( 17 import (
......
1 // Beego (http://beego.me/) 1 // Copyright 2014 beego Author. All Rights Reserved.
2 // 2 //
3 // @description beego is an open-source, high-performance web framework for the Go programming language. 3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
4 // 6 //
5 // @link http://github.com/astaxie/beego for the canonical source repository 7 // http://www.apache.org/licenses/LICENSE-2.0
6 // 8 //
7 // @license http://github.com/astaxie/beego/blob/master/LICENSE 9 // Unless required by applicable law or agreed to in writing, software
8 // 10 // distributed under the License is distributed on an "AS IS" BASIS,
9 // @authors astaxie 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14
10 package logs 15 package logs
11 16
12 import ( 17 import (
......
1 // Beego (http://beego.me/) 1 // Copyright 2014 beego Author. All Rights Reserved.
2 // 2 //
3 // @description beego is an open-source, high-performance web framework for the Go programming language. 3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
4 // 6 //
5 // @link http://github.com/astaxie/beego for the canonical source repository 7 // http://www.apache.org/licenses/LICENSE-2.0
6 // 8 //
7 // @license http://github.com/astaxie/beego/blob/master/LICENSE 9 // Unless required by applicable law or agreed to in writing, software
8 // 10 // distributed under the License is distributed on an "AS IS" BASIS,
9 // @authors astaxie 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14
10 package logs 15 package logs
11 16
12 import ( 17 import (
......
1 // Beego (http://beego.me/) 1 // Copyright 2014 beego Author. All Rights Reserved.
2 // 2 //
3 // @description beego is an open-source, high-performance web framework for the Go programming language. 3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
4 // 6 //
5 // @link http://github.com/astaxie/beego for the canonical source repository 7 // http://www.apache.org/licenses/LICENSE-2.0
6 // 8 //
7 // @license http://github.com/astaxie/beego/blob/master/LICENSE 9 // Unless required by applicable law or agreed to in writing, software
8 // 10 // distributed under the License is distributed on an "AS IS" BASIS,
9 // @authors astaxie 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14
10 package logs 15 package logs
11 16
12 import ( 17 import (
......
1 // Beego (http://beego.me/) 1 // Copyright 2014 beego Author. All Rights Reserved.
2 // 2 //
3 // @description beego is an open-source, high-performance web framework for the Go programming language. 3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
4 // 6 //
5 // @link http://github.com/astaxie/beego for the canonical source repository 7 // http://www.apache.org/licenses/LICENSE-2.0
6 // 8 //
7 // @license http://github.com/astaxie/beego/blob/master/LICENSE 9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14
15 // Usage:
16 //
17 // import "github.com/astaxie/beego/logs"
18 //
19 // log := NewLogger(10000)
20 // log.SetLogger("console", "")
21 //
22 // > the first params stand for how many channel
23 //
24 // Use it like this:
25 //
26 // log.Trace("trace")
27 // log.Info("info")
28 // log.Warn("warning")
29 // log.Debug("debug")
30 // log.Critical("critical")
8 // 31 //
9 // @authors astaxie 32 // more docs http://beego.me/docs/module/logs.md
10 package logs 33 package logs
11 34
12 import ( 35 import (
......
1 // Beego (http://beego.me/) 1 // Copyright 2014 beego Author. All Rights Reserved.
2 // 2 //
3 // @description beego is an open-source, high-performance web framework for the Go programming language. 3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
4 // 6 //
5 // @link http://github.com/astaxie/beego for the canonical source repository 7 // http://www.apache.org/licenses/LICENSE-2.0
6 // 8 //
7 // @license http://github.com/astaxie/beego/blob/master/LICENSE 9 // Unless required by applicable law or agreed to in writing, software
8 // 10 // distributed under the License is distributed on an "AS IS" BASIS,
9 // @authors astaxie 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14
10 package logs 15 package logs
11 16
12 import ( 17 import (
...@@ -77,7 +82,7 @@ func (s *SmtpWriter) WriteMsg(msg string, level int) error { ...@@ -77,7 +82,7 @@ func (s *SmtpWriter) WriteMsg(msg string, level int) error {
77 82
78 // Set up authentication information. 83 // Set up authentication information.
79 auth := s.GetSmtpAuth(hp[0]) 84 auth := s.GetSmtpAuth(hp[0])
80 85
81 // Connect to the server, authenticate, set the sender and recipient, 86 // Connect to the server, authenticate, set the sender and recipient,
82 // and send the email all in one step. 87 // and send the email all in one step.
83 content_type := "Content-Type: text/plain" + "; charset=UTF-8" 88 content_type := "Content-Type: text/plain" + "; charset=UTF-8"
......
1 // Beego (http://beego.me/) 1 // Copyright 2014 beego Author. All Rights Reserved.
2 // 2 //
3 // @description beego is an open-source, high-performance web framework for the Go programming language. 3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
4 // 6 //
5 // @link http://github.com/astaxie/beego for the canonical source repository 7 // http://www.apache.org/licenses/LICENSE-2.0
6 // 8 //
7 // @license http://github.com/astaxie/beego/blob/master/LICENSE 9 // Unless required by applicable law or agreed to in writing, software
8 // 10 // distributed under the License is distributed on an "AS IS" BASIS,
9 // @authors astaxie 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14
10 package logs 15 package logs
11 16
12 import ( 17 import (
......
1 // Beego (http://beego.me/) 1 // Copyright 2014 beego Author. All Rights Reserved.
2 // 2 //
3 // @description beego is an open-source, high-performance web framework for the Go programming language. 3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
4 // 6 //
5 // @link http://github.com/astaxie/beego for the canonical source repository 7 // http://www.apache.org/licenses/LICENSE-2.0
6 // 8 //
7 // @license http://github.com/astaxie/beego/blob/master/LICENSE 9 // Unless required by applicable law or agreed to in writing, software
8 // 10 // distributed under the License is distributed on an "AS IS" BASIS,
9 // @authors astaxie 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14
10 package beego 15 package beego
11 16
12 import ( 17 import (
......
1 // Beego (http://beego.me/) 1 // Copyright 2014 beego Author. All Rights Reserved.
2 // 2 //
3 // @description beego is an open-source, high-performance web framework for the Go programming language. 3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
4 // 6 //
5 // @link http://github.com/astaxie/beego for the canonical source repository 7 // http://www.apache.org/licenses/LICENSE-2.0
6 // 8 //
7 // @license http://github.com/astaxie/beego/blob/master/LICENSE 9 // Unless required by applicable law or agreed to in writing, software
8 // 10 // distributed under the License is distributed on an "AS IS" BASIS,
9 // @authors astaxie 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14
10 package middleware 15 package middleware
11 16
12 import ( 17 import (
......
1 // Beego (http://beego.me/) 1 // Copyright 2014 beego Author. All Rights Reserved.
2 // 2 //
3 // @description beego is an open-source, high-performance web framework for the Go programming language. 3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
4 // 6 //
5 // @link http://github.com/astaxie/beego for the canonical source repository 7 // http://www.apache.org/licenses/LICENSE-2.0
6 // 8 //
7 // @license http://github.com/astaxie/beego/blob/master/LICENSE 9 // Unless required by applicable law or agreed to in writing, software
8 // 10 // distributed under the License is distributed on an "AS IS" BASIS,
9 // @authors astaxie 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14
10 package middleware 15 package middleware
11 16
12 import "fmt" 17 import "fmt"
......
1 // Beego (http://beego.me/) 1 // Copyright 2014 beego Author. All Rights Reserved.
2 // 2 //
3 // @description beego is an open-source, high-performance web framework for the Go programming language. 3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
4 // 6 //
5 // @link http://github.com/astaxie/beego for the canonical source repository 7 // http://www.apache.org/licenses/LICENSE-2.0
6 // 8 //
7 // @license http://github.com/astaxie/beego/blob/master/LICENSE 9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14
15 // Usage:
16 //
17 // import "github.com/astaxie/beego/middleware"
18 //
19 // I18N = middleware.NewLocale("conf/i18n.conf", beego.AppConfig.String("language"))
8 // 20 //
9 // @authors astaxie 21 // more docs: http://beego.me/docs/module/i18n.md
10 package middleware 22 package middleware
11 23
12 import ( 24 import (
......
1 // Beego (http://beego.me/) 1 // Copyright 2014 beego Author. All Rights Reserved.
2 // 2 //
3 // @description beego is an open-source, high-performance web framework for the Go programming language. 3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
4 // 6 //
5 // @link http://github.com/astaxie/beego for the canonical source repository 7 // http://www.apache.org/licenses/LICENSE-2.0
6 // 8 //
7 // @license http://github.com/astaxie/beego/blob/master/LICENSE 9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14
15 // migration package for migration
8 // 16 //
9 // @authors astaxie 17 // The table structure is as follow:
10 // 18 //
11 // CREATE TABLE `migrations` ( 19 // CREATE TABLE `migrations` (
12 // `id_migration` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'surrogate key', 20 // `id_migration` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'surrogate key',
......
1 // Beego (http://beego.me/) 1 // Copyright 2014 beego Author. All Rights Reserved.
2 // 2 //
3 // @description beego is an open-source, high-performance web framework for the Go programming language. 3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
4 // 6 //
5 // @link http://github.com/astaxie/beego for the canonical source repository 7 // http://www.apache.org/licenses/LICENSE-2.0
6 // 8 //
7 // @license http://github.com/astaxie/beego/blob/master/LICENSE 9 // Unless required by applicable law or agreed to in writing, software
8 // 10 // distributed under the License is distributed on an "AS IS" BASIS,
9 // @authors astaxie 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14
10 package beego 15 package beego
11 16
12 import ( 17 import (
......
1 // Beego (http://beego.me/) 1 // Copyright 2014 beego Author. All Rights Reserved.
2 // 2 //
3 // @description beego is an open-source, high-performance web framework for the Go programming language. 3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
4 // 6 //
5 // @link http://github.com/astaxie/beego for the canonical source repository 7 // http://www.apache.org/licenses/LICENSE-2.0
6 // 8 //
7 // @license http://github.com/astaxie/beego/blob/master/LICENSE 9 // Unless required by applicable law or agreed to in writing, software
8 // 10 // distributed under the License is distributed on an "AS IS" BASIS,
9 // @authors astaxie 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14
10 package beego 15 package beego
11 16
12 import ( 17 import (
......
1 // Beego (http://beego.me/) 1 // Copyright 2014 beego Author. All Rights Reserved.
2 // 2 //
3 // @description beego is an open-source, high-performance web framework for the Go programming language. 3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
4 // 6 //
5 // @link http://github.com/astaxie/beego for the canonical source repository 7 // http://www.apache.org/licenses/LICENSE-2.0
6 // 8 //
7 // @license http://github.com/astaxie/beego/blob/master/LICENSE 9 // Unless required by applicable law or agreed to in writing, software
8 // 10 // distributed under the License is distributed on an "AS IS" BASIS,
9 // @authors astaxie 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14
10 package beego 15 package beego
11 16
12 import ( 17 import (
......
...@@ -154,10 +154,5 @@ note: not recommend use this in product env. ...@@ -154,10 +154,5 @@ note: not recommend use this in product env.
154 154
155 more details and examples in docs and test 155 more details and examples in docs and test
156 156
157 * [中文](http://beego.me/docs/Models_Overview?lang=zh) 157 [documents](http://beego.me/docs/mvc/model/overview.md)
158 * [English](http://beego.me/docs/Models_Overview?lang=en)
159 158
160 ## TODO
161 - some unrealized api
162 - examples
163 - docs
......
1 // Beego (http://beego.me/) 1 // Copyright 2014 beego Author. All Rights Reserved.
2 // 2 //
3 // @description beego is an open-source, high-performance web framework for the Go programming language. 3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
4 // 6 //
5 // @link http://github.com/astaxie/beego for the canonical source repository 7 // http://www.apache.org/licenses/LICENSE-2.0
6 // 8 //
7 // @license http://github.com/astaxie/beego/blob/master/LICENSE 9 // Unless required by applicable law or agreed to in writing, software
8 // 10 // distributed under the License is distributed on an "AS IS" BASIS,
9 // @authors astaxie, slene 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14
10 package orm 15 package orm
11 16
12 import ( 17 import (
......
1 // Beego (http://beego.me/) 1 // Copyright 2014 beego Author. All Rights Reserved.
2 // 2 //
3 // @description beego is an open-source, high-performance web framework for the Go programming language. 3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
4 // 6 //
5 // @link http://github.com/astaxie/beego for the canonical source repository 7 // http://www.apache.org/licenses/LICENSE-2.0
6 // 8 //
7 // @license http://github.com/astaxie/beego/blob/master/LICENSE 9 // Unless required by applicable law or agreed to in writing, software
8 // 10 // distributed under the License is distributed on an "AS IS" BASIS,
9 // @authors astaxie, slene 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14
10 package orm 15 package orm
11 16
12 import ( 17 import (
......
1 // Beego (http://beego.me/) 1 // Copyright 2014 beego Author. All Rights Reserved.
2 // 2 //
3 // @description beego is an open-source, high-performance web framework for the Go programming language. 3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
4 // 6 //
5 // @link http://github.com/astaxie/beego for the canonical source repository 7 // http://www.apache.org/licenses/LICENSE-2.0
6 // 8 //
7 // @license http://github.com/astaxie/beego/blob/master/LICENSE 9 // Unless required by applicable law or agreed to in writing, software
8 // 10 // distributed under the License is distributed on an "AS IS" BASIS,
9 // @authors astaxie, slene 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14
10 package orm 15 package orm
11 16
12 import ( 17 import (
......
1 // Beego (http://beego.me/) 1 // Copyright 2014 beego Author. All Rights Reserved.
2 // 2 //
3 // @description beego is an open-source, high-performance web framework for the Go programming language. 3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
4 // 6 //
5 // @link http://github.com/astaxie/beego for the canonical source repository 7 // http://www.apache.org/licenses/LICENSE-2.0
6 // 8 //
7 // @license http://github.com/astaxie/beego/blob/master/LICENSE 9 // Unless required by applicable law or agreed to in writing, software
8 // 10 // distributed under the License is distributed on an "AS IS" BASIS,
9 // @authors astaxie, slene 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14
10 package orm 15 package orm
11 16
12 import ( 17 import (
......
1 // Beego (http://beego.me/) 1 // Copyright 2014 beego Author. All Rights Reserved.
2 // 2 //
3 // @description beego is an open-source, high-performance web framework for the Go programming language. 3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
4 // 6 //
5 // @link http://github.com/astaxie/beego for the canonical source repository 7 // http://www.apache.org/licenses/LICENSE-2.0
6 // 8 //
7 // @license http://github.com/astaxie/beego/blob/master/LICENSE 9 // Unless required by applicable law or agreed to in writing, software
8 // 10 // distributed under the License is distributed on an "AS IS" BASIS,
9 // @authors astaxie, slene 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14
10 package orm 15 package orm
11 16
12 import ( 17 import (
......
1 // Beego (http://beego.me/) 1 // Copyright 2014 beego Author. All Rights Reserved.
2 // 2 //
3 // @description beego is an open-source, high-performance web framework for the Go programming language. 3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
4 // 6 //
5 // @link http://github.com/astaxie/beego for the canonical source repository 7 // http://www.apache.org/licenses/LICENSE-2.0
6 // 8 //
7 // @license http://github.com/astaxie/beego/blob/master/LICENSE 9 // Unless required by applicable law or agreed to in writing, software
8 // 10 // distributed under the License is distributed on an "AS IS" BASIS,
9 // @authors astaxie, slene 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14
10 package orm 15 package orm
11 16
12 // oracle dbBaser 17 // oracle dbBaser
......
1 // Beego (http://beego.me/) 1 // Copyright 2014 beego Author. All Rights Reserved.
2 // 2 //
3 // @description beego is an open-source, high-performance web framework for the Go programming language. 3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
4 // 6 //
5 // @link http://github.com/astaxie/beego for the canonical source repository 7 // http://www.apache.org/licenses/LICENSE-2.0
6 // 8 //
7 // @license http://github.com/astaxie/beego/blob/master/LICENSE 9 // Unless required by applicable law or agreed to in writing, software
8 // 10 // distributed under the License is distributed on an "AS IS" BASIS,
9 // @authors astaxie, slene 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14
10 package orm 15 package orm
11 16
12 import ( 17 import (
......
1 // Beego (http://beego.me/) 1 // Copyright 2014 beego Author. All Rights Reserved.
2 // 2 //
3 // @description beego is an open-source, high-performance web framework for the Go programming language. 3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
4 // 6 //
5 // @link http://github.com/astaxie/beego for the canonical source repository 7 // http://www.apache.org/licenses/LICENSE-2.0
6 // 8 //
7 // @license http://github.com/astaxie/beego/blob/master/LICENSE 9 // Unless required by applicable law or agreed to in writing, software
8 // 10 // distributed under the License is distributed on an "AS IS" BASIS,
9 // @authors astaxie, slene 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14
10 package orm 15 package orm
11 16
12 import ( 17 import (
......
1 // Beego (http://beego.me/) 1 // Copyright 2014 beego Author. All Rights Reserved.
2 // 2 //
3 // @description beego is an open-source, high-performance web framework for the Go programming language. 3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
4 // 6 //
5 // @link http://github.com/astaxie/beego for the canonical source repository 7 // http://www.apache.org/licenses/LICENSE-2.0
6 // 8 //
7 // @license http://github.com/astaxie/beego/blob/master/LICENSE 9 // Unless required by applicable law or agreed to in writing, software
8 // 10 // distributed under the License is distributed on an "AS IS" BASIS,
9 // @authors astaxie, slene 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14
10 package orm 15 package orm
11 16
12 import ( 17 import (
......
1 // Beego (http://beego.me/) 1 // Copyright 2014 beego Author. All Rights Reserved.
2 // 2 //
3 // @description beego is an open-source, high-performance web framework for the Go programming language. 3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
4 // 6 //
5 // @link http://github.com/astaxie/beego for the canonical source repository 7 // http://www.apache.org/licenses/LICENSE-2.0
6 // 8 //
7 // @license http://github.com/astaxie/beego/blob/master/LICENSE 9 // Unless required by applicable law or agreed to in writing, software
8 // 10 // distributed under the License is distributed on an "AS IS" BASIS,
9 // @authors astaxie, slene 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14
10 package orm 15 package orm
11 16
12 import ( 17 import (
......
1 // Beego (http://beego.me/) 1 // Copyright 2014 beego Author. All Rights Reserved.
2 // 2 //
3 // @description beego is an open-source, high-performance web framework for the Go programming language. 3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
4 // 6 //
5 // @link http://github.com/astaxie/beego for the canonical source repository 7 // http://www.apache.org/licenses/LICENSE-2.0
6 // 8 //
7 // @license http://github.com/astaxie/beego/blob/master/LICENSE 9 // Unless required by applicable law or agreed to in writing, software
8 // 10 // distributed under the License is distributed on an "AS IS" BASIS,
9 // @authors astaxie, slene 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14
10 package orm 15 package orm
11 16
12 import ( 17 import (
......
1 // Beego (http://beego.me/) 1 // Copyright 2014 beego Author. All Rights Reserved.
2 // 2 //
3 // @description beego is an open-source, high-performance web framework for the Go programming language. 3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
4 // 6 //
5 // @link http://github.com/astaxie/beego for the canonical source repository 7 // http://www.apache.org/licenses/LICENSE-2.0
6 // 8 //
7 // @license http://github.com/astaxie/beego/blob/master/LICENSE 9 // Unless required by applicable law or agreed to in writing, software
8 // 10 // distributed under the License is distributed on an "AS IS" BASIS,
9 // @authors astaxie, slene 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14
10 package orm 15 package orm
11 16
12 import ( 17 import (
......
1 // Beego (http://beego.me/) 1 // Copyright 2014 beego Author. All Rights Reserved.
2 // 2 //
3 // @description beego is an open-source, high-performance web framework for the Go programming language. 3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
4 // 6 //
5 // @link http://github.com/astaxie/beego for the canonical source repository 7 // http://www.apache.org/licenses/LICENSE-2.0
6 // 8 //
7 // @license http://github.com/astaxie/beego/blob/master/LICENSE 9 // Unless required by applicable law or agreed to in writing, software
8 // 10 // distributed under the License is distributed on an "AS IS" BASIS,
9 // @authors astaxie, slene 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14
10 package orm 15 package orm
11 16
12 import ( 17 import (
......
1 // Beego (http://beego.me/) 1 // Copyright 2014 beego Author. All Rights Reserved.
2 // 2 //
3 // @description beego is an open-source, high-performance web framework for the Go programming language. 3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
4 // 6 //
5 // @link http://github.com/astaxie/beego for the canonical source repository 7 // http://www.apache.org/licenses/LICENSE-2.0
6 // 8 //
7 // @license http://github.com/astaxie/beego/blob/master/LICENSE 9 // Unless required by applicable law or agreed to in writing, software
8 // 10 // distributed under the License is distributed on an "AS IS" BASIS,
9 // @authors astaxie, slene 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14
10 package orm 15 package orm
11 16
12 import ( 17 import (
......
1 // Beego (http://beego.me/) 1 // Copyright 2014 beego Author. All Rights Reserved.
2 // 2 //
3 // @description beego is an open-source, high-performance web framework for the Go programming language. 3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
4 // 6 //
5 // @link http://github.com/astaxie/beego for the canonical source repository 7 // http://www.apache.org/licenses/LICENSE-2.0
6 // 8 //
7 // @license http://github.com/astaxie/beego/blob/master/LICENSE 9 // Unless required by applicable law or agreed to in writing, software
8 // 10 // distributed under the License is distributed on an "AS IS" BASIS,
9 // @authors astaxie, slene 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14
10 package orm 15 package orm
11 16
12 import ( 17 import (
......
1 // Beego (http://beego.me/) 1 // Copyright 2014 beego Author. All Rights Reserved.
2 // 2 //
3 // @description beego is an open-source, high-performance web framework for the Go programming language. 3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
4 // 6 //
5 // @link http://github.com/astaxie/beego for the canonical source repository 7 // http://www.apache.org/licenses/LICENSE-2.0
6 // 8 //
7 // @license http://github.com/astaxie/beego/blob/master/LICENSE 9 // Unless required by applicable law or agreed to in writing, software
8 // 10 // distributed under the License is distributed on an "AS IS" BASIS,
9 // @authors astaxie, slene 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14
10 package orm 15 package orm
11 16
12 import ( 17 import (
......
1 // Beego (http://beego.me/) 1 // Copyright 2014 beego Author. All Rights Reserved.
2 // 2 //
3 // @description beego is an open-source, high-performance web framework for the Go programming language. 3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
4 // 6 //
5 // @link http://github.com/astaxie/beego for the canonical source repository 7 // http://www.apache.org/licenses/LICENSE-2.0
6 // 8 //
7 // @license http://github.com/astaxie/beego/blob/master/LICENSE 9 // Unless required by applicable law or agreed to in writing, software
8 // 10 // distributed under the License is distributed on an "AS IS" BASIS,
9 // @authors astaxie, slene 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14
10 package orm 15 package orm
11 16
12 import ( 17 import (
......
1 // Beego (http://beego.me/) 1 // Copyright 2014 beego Author. All Rights Reserved.
2 // 2 //
3 // @description beego is an open-source, high-performance web framework for the Go programming language. 3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
4 // 6 //
5 // @link http://github.com/astaxie/beego for the canonical source repository 7 // http://www.apache.org/licenses/LICENSE-2.0
6 // 8 //
7 // @license http://github.com/astaxie/beego/blob/master/LICENSE 9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14
15 // Simple Usage
16 //
17 // package main
18 //
19 // import (
20 // "fmt"
21 // "github.com/astaxie/beego/orm"
22 // _ "github.com/go-sql-driver/mysql" // import your used driver
23 // )
24 //
25 // // Model Struct
26 // type User struct {
27 // Id int `orm:"auto"`
28 // Name string `orm:"size(100)"`
29 // }
30 //
31 // func init() {
32 // orm.RegisterDataBase("default", "mysql", "root:root@/my_db?charset=utf8", 30)
33 // }
34 //
35 // func main() {
36 // o := orm.NewOrm()
37 // user := User{Name: "slene"}
38 // // insert
39 // id, err := o.Insert(&user)
40 // // update
41 // user.Name = "astaxie"
42 // num, err := o.Update(&user)
43 // // read one
44 // u := User{Id: user.Id}
45 // err = o.Read(&u)
46 // // delete
47 // num, err = o.Delete(&u)
48 // }
8 // 49 //
9 // @authors astaxie, slene 50 // more docs: http://beego.me/docs/mvc/model/overview.md
10 package orm 51 package orm
11 52
12 import ( 53 import (
......
1 // Beego (http://beego.me/) 1 // Copyright 2014 beego Author. All Rights Reserved.
2 // 2 //
3 // @description beego is an open-source, high-performance web framework for the Go programming language. 3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
4 // 6 //
5 // @link http://github.com/astaxie/beego for the canonical source repository 7 // http://www.apache.org/licenses/LICENSE-2.0
6 // 8 //
7 // @license http://github.com/astaxie/beego/blob/master/LICENSE 9 // Unless required by applicable law or agreed to in writing, software
8 // 10 // distributed under the License is distributed on an "AS IS" BASIS,
9 // @authors astaxie, slene 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14
10 package orm 15 package orm
11 16
12 import ( 17 import (
......
1 // Beego (http://beego.me/) 1 // Copyright 2014 beego Author. All Rights Reserved.
2 // 2 //
3 // @description beego is an open-source, high-performance web framework for the Go programming language. 3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
4 // 6 //
5 // @link http://github.com/astaxie/beego for the canonical source repository 7 // http://www.apache.org/licenses/LICENSE-2.0
6 // 8 //
7 // @license http://github.com/astaxie/beego/blob/master/LICENSE 9 // Unless required by applicable law or agreed to in writing, software
8 // 10 // distributed under the License is distributed on an "AS IS" BASIS,
9 // @authors astaxie, slene 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14
10 package orm 15 package orm
11 16
12 import ( 17 import (
......
1 // Beego (http://beego.me/) 1 // Copyright 2014 beego Author. All Rights Reserved.
2 // 2 //
3 // @description beego is an open-source, high-performance web framework for the Go programming language. 3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
4 // 6 //
5 // @link http://github.com/astaxie/beego for the canonical source repository 7 // http://www.apache.org/licenses/LICENSE-2.0
6 // 8 //
7 // @license http://github.com/astaxie/beego/blob/master/LICENSE 9 // Unless required by applicable law or agreed to in writing, software
8 // 10 // distributed under the License is distributed on an "AS IS" BASIS,
9 // @authors astaxie, slene 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14
10 package orm 15 package orm
11 16
12 import ( 17 import (
......
1 // Beego (http://beego.me/) 1 // Copyright 2014 beego Author. All Rights Reserved.
2 // 2 //
3 // @description beego is an open-source, high-performance web framework for the Go programming language. 3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
4 // 6 //
5 // @link http://github.com/astaxie/beego for the canonical source repository 7 // http://www.apache.org/licenses/LICENSE-2.0
6 // 8 //
7 // @license http://github.com/astaxie/beego/blob/master/LICENSE 9 // Unless required by applicable law or agreed to in writing, software
8 // 10 // distributed under the License is distributed on an "AS IS" BASIS,
9 // @authors astaxie, slene 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14
10 package orm 15 package orm
11 16
12 import ( 17 import (
......
1 // Beego (http://beego.me/) 1 // Copyright 2014 beego Author. All Rights Reserved.
2 // 2 //
3 // @description beego is an open-source, high-performance web framework for the Go programming language. 3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
4 // 6 //
5 // @link http://github.com/astaxie/beego for the canonical source repository 7 // http://www.apache.org/licenses/LICENSE-2.0
6 // 8 //
7 // @license http://github.com/astaxie/beego/blob/master/LICENSE 9 // Unless required by applicable law or agreed to in writing, software
8 // 10 // distributed under the License is distributed on an "AS IS" BASIS,
9 // @authors astaxie, slene 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14
10 package orm 15 package orm
11 16
12 import ( 17 import (
......
1 // Beego (http://beego.me/) 1 // Copyright 2014 beego Author. All Rights Reserved.
2 // 2 //
3 // @description beego is an open-source, high-performance web framework for the Go programming language. 3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
4 // 6 //
5 // @link http://github.com/astaxie/beego for the canonical source repository 7 // http://www.apache.org/licenses/LICENSE-2.0
6 // 8 //
7 // @license http://github.com/astaxie/beego/blob/master/LICENSE 9 // Unless required by applicable law or agreed to in writing, software
8 // 10 // distributed under the License is distributed on an "AS IS" BASIS,
9 // @authors astaxie, slene 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14
10 package orm 15 package orm
11 16
12 import ( 17 import (
......
1 // Beego (http://beego.me/) 1 // Copyright 2014 beego Author. All Rights Reserved.
2 // 2 //
3 // @description beego is an open-source, high-performance web framework for the Go programming language. 3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
4 // 6 //
5 // @link http://github.com/astaxie/beego for the canonical source repository 7 // http://www.apache.org/licenses/LICENSE-2.0
6 // 8 //
7 // @license http://github.com/astaxie/beego/blob/master/LICENSE 9 // Unless required by applicable law or agreed to in writing, software
8 // 10 // distributed under the License is distributed on an "AS IS" BASIS,
9 // @authors astaxie, slene 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14
10 package orm 15 package orm
11 16
12 import ( 17 import (
......
1 // Beego (http://beego.me/) 1 // Copyright 2014 beego Author. All Rights Reserved.
2 // 2 //
3 // @description beego is an open-source, high-performance web framework for the Go programming language. 3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
4 // 6 //
5 // @link http://github.com/astaxie/beego for the canonical source repository 7 // http://www.apache.org/licenses/LICENSE-2.0
6 // 8 //
7 // @license http://github.com/astaxie/beego/blob/master/LICENSE 9 // Unless required by applicable law or agreed to in writing, software
8 // 10 // distributed under the License is distributed on an "AS IS" BASIS,
9 // @authors astaxie, slene 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14
10 package orm 15 package orm
11 16
12 import ( 17 import (
......
1 // Beego (http://beego.me/) 1 // Copyright 2014 beego Author. All Rights Reserved.
2 // 2 //
3 // @description beego is an open-source, high-performance web framework for the Go programming language. 3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
4 // 6 //
5 // @link http://github.com/astaxie/beego for the canonical source repository 7 // http://www.apache.org/licenses/LICENSE-2.0
6 // 8 //
7 // @license http://github.com/astaxie/beego/blob/master/LICENSE 9 // Unless required by applicable law or agreed to in writing, software
8 // 10 // distributed under the License is distributed on an "AS IS" BASIS,
9 // @authors astaxie, slene 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14
10 package orm 15 package orm
11 16
12 import ( 17 import (
......
1 // Beego (http://beego.me/) 1 // Copyright 2014 beego Author. All Rights Reserved.
2 // 2 //
3 // @description beego is an open-source, high-performance web framework for the Go programming language. 3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
4 // 6 //
5 // @link http://github.com/astaxie/beego for the canonical source repository 7 // http://www.apache.org/licenses/LICENSE-2.0
6 // 8 //
7 // @license http://github.com/astaxie/beego/blob/master/LICENSE 9 // Unless required by applicable law or agreed to in writing, software
8 // 10 // distributed under the License is distributed on an "AS IS" BASIS,
9 // @authors astaxie 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14
10 package beego 15 package beego
11 16
12 import ( 17 import (
......
...@@ -27,11 +27,11 @@ ...@@ -27,11 +27,11 @@
27 // 27 //
28 // 28 //
29 // Advanced Usage: 29 // Advanced Usage:
30 // func SecretAuth(username, password string) bool { 30 // func SecretAuth(username, password string) bool {
31 // return username == "astaxie" && password == "helloBeego" 31 // return username == "astaxie" && password == "helloBeego"
32 // } 32 // }
33 // authPlugin := auth.NewBasicAuthenticator(SecretAuth, "Authorization Required") 33 // authPlugin := auth.NewBasicAuthenticator(SecretAuth, "Authorization Required")
34 // beego.InsertFilter("*", beego.BeforeRouter,authPlugin) 34 // beego.InsertFilter("*", beego.BeforeRouter,authPlugin)
35 package auth 35 package auth
36 36
37 import ( 37 import (
......
...@@ -14,26 +14,25 @@ ...@@ -14,26 +14,25 @@
14 14
15 // Package cors provides handlers to enable CORS support. 15 // Package cors provides handlers to enable CORS support.
16 // Usage 16 // Usage
17 // 17 // import (
18 // import ( 18 // "github.com/astaxie/beego"
19 // "github.com/astaxie/beego" 19 // "github.com/astaxie/beego/plugins/cors"
20 // "github.com/astaxie/beego/plugins/cors"
21 // ) 20 // )
22 21 //
23 //func main() { 22 // func main() {
24 // // CORS for https://foo.* origins, allowing: 23 // // CORS for https://foo.* origins, allowing:
25 // // - PUT and PATCH methods 24 // // - PUT and PATCH methods
26 // // - Origin header 25 // // - Origin header
27 // // - Credentials share 26 // // - Credentials share
28 // beego.InsertFilter("*", beego.BeforeRouter,cors.Allow(&cors.Options{ 27 // beego.InsertFilter("*", beego.BeforeRouter,cors.Allow(&cors.Options{
29 // AllowOrigins: []string{"https://*.foo.com"}, 28 // AllowOrigins: []string{"https://*.foo.com"},
30 // AllowMethods: []string{"PUT", "PATCH"}, 29 // AllowMethods: []string{"PUT", "PATCH"},
31 // AllowHeaders: []string{"Origin"}, 30 // AllowHeaders: []string{"Origin"},
32 // ExposeHeaders: []string{"Content-Length"}, 31 // ExposeHeaders: []string{"Content-Length"},
33 // AllowCredentials: true, 32 // AllowCredentials: true,
34 // })) 33 // }))
35 // beego.Run() 34 // beego.Run()
36 //} 35 // }
37 package cors 36 package cors
38 37
39 import ( 38 import (
......
...@@ -12,7 +12,6 @@ ...@@ -12,7 +12,6 @@
12 // See the License for the specific language governing permissions and 12 // See the License for the specific language governing permissions and
13 // limitations under the License. 13 // limitations under the License.
14 14
15 // Package cors provides handlers to enable CORS support.
16 package cors 15 package cors
17 16
18 import ( 17 import (
......
1 // Beego (http://beego.me/) 1 // Copyright 2014 beego Author. All Rights Reserved.
2 // 2 //
3 // @description beego is an open-source, high-performance web framework for the Go programming language. 3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
4 // 6 //
5 // @link http://github.com/astaxie/beego for the canonical source repository 7 // http://www.apache.org/licenses/LICENSE-2.0
6 // 8 //
7 // @license http://github.com/astaxie/beego/blob/master/LICENSE 9 // Unless required by applicable law or agreed to in writing, software
8 // 10 // distributed under the License is distributed on an "AS IS" BASIS,
9 // @authors astaxie 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14
10 package beego 15 package beego
11 16
12 import ( 17 import (
......
1 // Beego (http://beego.me/) 1 // Copyright 2014 beego Author. All Rights Reserved.
2 // 2 //
3 // @description beego is an open-source, high-performance web framework for the Go programming language. 3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
4 // 6 //
5 // @link http://github.com/astaxie/beego for the canonical source repository 7 // http://www.apache.org/licenses/LICENSE-2.0
6 // 8 //
7 // @license http://github.com/astaxie/beego/blob/master/LICENSE 9 // Unless required by applicable law or agreed to in writing, software
8 // 10 // distributed under the License is distributed on an "AS IS" BASIS,
9 // @authors astaxie 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14
10 package beego 15 package beego
11 16
12 import ( 17 import (
......
1 // Beego (http://beego.me/) 1 // Copyright 2014 beego Author. All Rights Reserved.
2 // 2 //
3 // @description beego is an open-source, high-performance web framework for the Go programming language. 3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
4 // 6 //
5 // @link http://github.com/astaxie/beego for the canonical source repository 7 // http://www.apache.org/licenses/LICENSE-2.0
6 // 8 //
7 // @license http://github.com/astaxie/beego/blob/master/LICENSE 9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14
15 // package couchbase for session provider
16 //
17 // depend on github.com/couchbaselabs/go-couchbasee
18 //
19 // go install github.com/couchbaselabs/go-couchbase
20 //
21 // Usage:
22 // import(
23 // _ "github.com/astaxie/beego/session/couchbase"
24 // "github.com/astaxie/beego/session"
25 // )
26 //
27 // func init() {
28 // globalSessions, _ = session.NewManager("couchbase", ``{"cookieName":"gosessionid","gclifetime":3600,"ProviderConfig":"http://host:port/, Pool, Bucket"}``)
29 // go globalSessions.GC()
30 // }
8 // 31 //
9 // @authors astaxie 32 // more docs: http://beego.me/docs/module/session.md
10 package session 33 package session
11 34
12 import ( 35 import (
......
1 // Beego (http://beego.me/) 1 // Copyright 2014 beego Author. All Rights Reserved.
2 // 2 //
3 // @description beego is an open-source, high-performance web framework for the Go programming language. 3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
4 // 6 //
5 // @link http://github.com/astaxie/beego for the canonical source repository 7 // http://www.apache.org/licenses/LICENSE-2.0
6 // 8 //
7 // @license http://github.com/astaxie/beego/blob/master/LICENSE 9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14
15 // package memcache for session provider
16 //
17 // depend on github.com/bradfitz/gomemcache/memcache
18 //
19 // go install github.com/bradfitz/gomemcache/memcache
20 //
21 // Usage:
22 // import(
23 // _ "github.com/astaxie/beego/session/memcache"
24 // "github.com/astaxie/beego/session"
25 // )
26 //
27 // func init() {
28 // globalSessions, _ = session.NewManager("memcache", ``{"cookieName":"gosessionid","gclifetime":3600,"ProviderConfig":"127.0.0.1:11211"}``)
29 // go globalSessions.GC()
30 // }
8 // 31 //
9 // @authors astaxie 32 // more docs: http://beego.me/docs/module/session.md
10 package session 33 package session
11 34
12 import ( 35 import (
...@@ -65,12 +88,12 @@ func (rs *MemcacheSessionStore) Flush() error { ...@@ -65,12 +88,12 @@ func (rs *MemcacheSessionStore) Flush() error {
65 return nil 88 return nil
66 } 89 }
67 90
68 // get redis session id 91 // get memcache session id
69 func (rs *MemcacheSessionStore) SessionID() string { 92 func (rs *MemcacheSessionStore) SessionID() string {
70 return rs.sid 93 return rs.sid
71 } 94 }
72 95
73 // save session values to redis 96 // save session values to memcache
74 func (rs *MemcacheSessionStore) SessionRelease(w http.ResponseWriter) { 97 func (rs *MemcacheSessionStore) SessionRelease(w http.ResponseWriter) {
75 b, err := session.EncodeGob(rs.values) 98 b, err := session.EncodeGob(rs.values)
76 if err != nil { 99 if err != nil {
...@@ -80,7 +103,7 @@ func (rs *MemcacheSessionStore) SessionRelease(w http.ResponseWriter) { ...@@ -80,7 +103,7 @@ func (rs *MemcacheSessionStore) SessionRelease(w http.ResponseWriter) {
80 client.Set(&item) 103 client.Set(&item)
81 } 104 }
82 105
83 // redis session provider 106 // memcahe session provider
84 type MemProvider struct { 107 type MemProvider struct {
85 maxlifetime int64 108 maxlifetime int64
86 conninfo []string 109 conninfo []string
...@@ -88,7 +111,7 @@ type MemProvider struct { ...@@ -88,7 +111,7 @@ type MemProvider struct {
88 password string 111 password string
89 } 112 }
90 113
91 // init redis session 114 // init memcache session
92 // savepath like 115 // savepath like
93 // e.g. 127.0.0.1:9090 116 // e.g. 127.0.0.1:9090
94 func (rp *MemProvider) SessionInit(maxlifetime int64, savePath string) error { 117 func (rp *MemProvider) SessionInit(maxlifetime int64, savePath string) error {
...@@ -98,7 +121,7 @@ func (rp *MemProvider) SessionInit(maxlifetime int64, savePath string) error { ...@@ -98,7 +121,7 @@ func (rp *MemProvider) SessionInit(maxlifetime int64, savePath string) error {
98 return nil 121 return nil
99 } 122 }
100 123
101 // read redis session by sid 124 // read memcache session by sid
102 func (rp *MemProvider) SessionRead(sid string) (session.SessionStore, error) { 125 func (rp *MemProvider) SessionRead(sid string) (session.SessionStore, error) {
103 if client == nil { 126 if client == nil {
104 if err := rp.connectInit(); err != nil { 127 if err := rp.connectInit(); err != nil {
...@@ -123,7 +146,7 @@ func (rp *MemProvider) SessionRead(sid string) (session.SessionStore, error) { ...@@ -123,7 +146,7 @@ func (rp *MemProvider) SessionRead(sid string) (session.SessionStore, error) {
123 return rs, nil 146 return rs, nil
124 } 147 }
125 148
126 // check redis session exist by sid 149 // check memcache session exist by sid
127 func (rp *MemProvider) SessionExist(sid string) bool { 150 func (rp *MemProvider) SessionExist(sid string) bool {
128 if client == nil { 151 if client == nil {
129 if err := rp.connectInit(); err != nil { 152 if err := rp.connectInit(); err != nil {
...@@ -137,7 +160,7 @@ func (rp *MemProvider) SessionExist(sid string) bool { ...@@ -137,7 +160,7 @@ func (rp *MemProvider) SessionExist(sid string) bool {
137 } 160 }
138 } 161 }
139 162
140 // generate new sid for redis session 163 // generate new sid for memcache session
141 func (rp *MemProvider) SessionRegenerate(oldsid, sid string) (session.SessionStore, error) { 164 func (rp *MemProvider) SessionRegenerate(oldsid, sid string) (session.SessionStore, error) {
142 if client == nil { 165 if client == nil {
143 if err := rp.connectInit(); err != nil { 166 if err := rp.connectInit(); err != nil {
...@@ -177,7 +200,7 @@ func (rp *MemProvider) SessionRegenerate(oldsid, sid string) (session.SessionSto ...@@ -177,7 +200,7 @@ func (rp *MemProvider) SessionRegenerate(oldsid, sid string) (session.SessionSto
177 return rs, nil 200 return rs, nil
178 } 201 }
179 202
180 // delete redis session by id 203 // delete memcache session by id
181 func (rp *MemProvider) SessionDestroy(sid string) error { 204 func (rp *MemProvider) SessionDestroy(sid string) error {
182 if client == nil { 205 if client == nil {
183 if err := rp.connectInit(); err != nil { 206 if err := rp.connectInit(); err != nil {
......
1 // Beego (http://beego.me/) 1 // Copyright 2014 beego Author. All Rights Reserved.
2 // 2 //
3 // @description beego is an open-source, high-performance web framework for the Go programming language. 3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
4 // 6 //
5 // @link http://github.com/astaxie/beego for the canonical source repository 7 // http://www.apache.org/licenses/LICENSE-2.0
6 // 8 //
7 // @license http://github.com/astaxie/beego/blob/master/LICENSE 9 // Unless required by applicable law or agreed to in writing, software
8 // 10 // distributed under the License is distributed on an "AS IS" BASIS,
9 // @authors astaxie 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10 package session 12 // See the License for the specific language governing permissions and
13 // limitations under the License.
11 14
15 // package mysql for session provider
16 //
17 // depends on github.com/go-sql-driver/mysql:
18 //
19 // go install github.com/go-sql-driver/mysql
20 //
12 // mysql session support need create table as sql: 21 // mysql session support need create table as sql:
13 // CREATE TABLE `session` ( 22 // CREATE TABLE `session` (
14 // `session_key` char(64) NOT NULL, 23 // `session_key` char(64) NOT NULL,
...@@ -16,6 +25,20 @@ package session ...@@ -16,6 +25,20 @@ package session
16 // `session_expiry` int(11) unsigned NOT NULL, 25 // `session_expiry` int(11) unsigned NOT NULL,
17 // PRIMARY KEY (`session_key`) 26 // PRIMARY KEY (`session_key`)
18 // ) ENGINE=MyISAM DEFAULT CHARSET=utf8; 27 // ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
28 //
29 // Usage:
30 // import(
31 // _ "github.com/astaxie/beego/session/mysql"
32 // "github.com/astaxie/beego/session"
33 // )
34 //
35 // func init() {
36 // globalSessions, _ = session.NewManager("mysql", ``{"cookieName":"gosessionid","gclifetime":3600,"ProviderConfig":"[username[:password]@][protocol[(address)]]/dbname[?param1=value1&...&paramN=valueN]"}``)
37 // go globalSessions.GC()
38 // }
39 //
40 // more docs: http://beego.me/docs/module/session.md
41 package session
19 42
20 import ( 43 import (
21 "database/sql" 44 "database/sql"
......
1 // Beego (http://beego.me/) 1 // Copyright 2014 beego Author. All Rights Reserved.
2 // 2 //
3 // @description beego is an open-source, high-performance web framework for the Go programming language. 3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
4 // 6 //
5 // @link http://github.com/astaxie/beego for the canonical source repository 7 // http://www.apache.org/licenses/LICENSE-2.0
6 // 8 //
7 // @license http://github.com/astaxie/beego/blob/master/LICENSE 9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14
15 // package postgresql for session provider
16 //
17 // depends on github.com/lib/pq:
18 //
19 // go install github.com/lib/pq
20 //
21 //
22 // needs this table in your database:
8 // 23 //
9 // @authors astaxie 24 // CREATE TABLE session (
25 // session_key char(64) NOT NULL,
26 // session_data bytea,
27 // session_expiry timestamp NOT NULL,
28 // CONSTRAINT session_key PRIMARY KEY(session_key)
29 // );
30
31 // will be activated with these settings in app.conf:
32
33 // SessionOn = true
34 // SessionProvider = postgresql
35 // SessionSavePath = "user=a password=b dbname=c sslmode=disable"
36 // SessionName = session
37 //
38 //
39 // Usage:
40 // import(
41 // _ "github.com/astaxie/beego/session/postgresql"
42 // "github.com/astaxie/beego/session"
43 // )
44 //
45 // func init() {
46 // globalSessions, _ = session.NewManager("postgresql", ``{"cookieName":"gosessionid","gclifetime":3600,"ProviderConfig":"user=pqgotest dbname=pqgotest sslmode=verify-full"}``)
47 // go globalSessions.GC()
48 // }
49 //
50 // more docs: http://beego.me/docs/module/session.md
10 package session 51 package session
11 52
12 /*
13
14 beego session provider for postgresql
15 -------------------------------------
16
17 depends on github.com/lib/pq:
18
19 go install github.com/lib/pq
20
21
22 needs this table in your database:
23
24 CREATE TABLE session (
25 session_key char(64) NOT NULL,
26 session_data bytea,
27 session_expiry timestamp NOT NULL,
28 CONSTRAINT session_key PRIMARY KEY(session_key)
29 );
30
31
32 will be activated with these settings in app.conf:
33
34 SessionOn = true
35 SessionProvider = postgresql
36 SessionSavePath = "user=a password=b dbname=c sslmode=disable"
37 SessionName = session
38
39 */
40
41 import ( 53 import (
42 "database/sql" 54 "database/sql"
43 "net/http" 55 "net/http"
......
1 // Beego (http://beego.me/) 1 // Copyright 2014 beego Author. All Rights Reserved.
2 // 2 //
3 // @description beego is an open-source, high-performance web framework for the Go programming language. 3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
4 // 6 //
5 // @link http://github.com/astaxie/beego for the canonical source repository 7 // http://www.apache.org/licenses/LICENSE-2.0
6 // 8 //
7 // @license http://github.com/astaxie/beego/blob/master/LICENSE 9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14
15 // package redis for session provider
16 //
17 // depend on github.com/garyburd/redigo/redis
18 //
19 // go install github.com/garyburd/redigo/redis
20 //
21 // Usage:
22 // import(
23 // _ "github.com/astaxie/beego/session/redis"
24 // "github.com/astaxie/beego/session"
25 // )
26 //
27 // func init() {
28 // globalSessions, _ = session.NewManager("redis", ``{"cookieName":"gosessionid","gclifetime":3600,"ProviderConfig":"127.0.0.1:7070"}``)
29 // go globalSessions.GC()
30 // }
8 // 31 //
9 // @authors astaxie 32 // more docs: http://beego.me/docs/module/session.md
10 package session 33 package session
11 34
12 import ( 35 import (
...@@ -17,7 +40,7 @@ import ( ...@@ -17,7 +40,7 @@ import (
17 40
18 "github.com/astaxie/beego/session" 41 "github.com/astaxie/beego/session"
19 42
20 "github.com/beego/redigo/redis" 43 "github.com/garyburd/redigo/redis"
21 ) 44 )
22 45
23 var redispder = &RedisProvider{} 46 var redispder = &RedisProvider{}
......
1 // Beego (http://beego.me/) 1 // Copyright 2014 beego Author. All Rights Reserved.
2 // 2 //
3 // @description beego is an open-source, high-performance web framework for the Go programming language. 3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
4 // 6 //
5 // @link http://github.com/astaxie/beego for the canonical source repository 7 // http://www.apache.org/licenses/LICENSE-2.0
6 // 8 //
7 // @license http://github.com/astaxie/beego/blob/master/LICENSE 9 // Unless required by applicable law or agreed to in writing, software
8 // 10 // distributed under the License is distributed on an "AS IS" BASIS,
9 // @authors astaxie 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14
10 package session 15 package session
11 16
12 import ( 17 import (
......
1 // Beego (http://beego.me/) 1 // Copyright 2014 beego Author. All Rights Reserved.
2 // 2 //
3 // @description beego is an open-source, high-performance web framework for the Go programming language. 3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
4 // 6 //
5 // @link http://github.com/astaxie/beego for the canonical source repository 7 // http://www.apache.org/licenses/LICENSE-2.0
6 // 8 //
7 // @license http://github.com/astaxie/beego/blob/master/LICENSE 9 // Unless required by applicable law or agreed to in writing, software
8 // 10 // distributed under the License is distributed on an "AS IS" BASIS,
9 // @authors astaxie 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14
10 package session 15 package session
11 16
12 import ( 17 import (
......
1 // Beego (http://beego.me/) 1 // Copyright 2014 beego Author. All Rights Reserved.
2 // 2 //
3 // @description beego is an open-source, high-performance web framework for the Go programming language. 3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
4 // 6 //
5 // @link http://github.com/astaxie/beego for the canonical source repository 7 // http://www.apache.org/licenses/LICENSE-2.0
6 // 8 //
7 // @license http://github.com/astaxie/beego/blob/master/LICENSE 9 // Unless required by applicable law or agreed to in writing, software
8 // 10 // distributed under the License is distributed on an "AS IS" BASIS,
9 // @authors astaxie 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14
10 package session 15 package session
11 16
12 import ( 17 import (
......
1 // Beego (http://beego.me/) 1 // Copyright 2014 beego Author. All Rights Reserved.
2 // 2 //
3 // @description beego is an open-source, high-performance web framework for the Go programming language. 3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
4 // 6 //
5 // @link http://github.com/astaxie/beego for the canonical source repository 7 // http://www.apache.org/licenses/LICENSE-2.0
6 // 8 //
7 // @license http://github.com/astaxie/beego/blob/master/LICENSE 9 // Unless required by applicable law or agreed to in writing, software
8 // 10 // distributed under the License is distributed on an "AS IS" BASIS,
9 // @authors astaxie 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14
10 package session 15 package session
11 16
12 import ( 17 import (
......
1 // Beego (http://beego.me/) 1 // Copyright 2014 beego Author. All Rights Reserved.
2 // 2 //
3 // @description beego is an open-source, high-performance web framework for the Go programming language. 3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
4 // 6 //
5 // @link http://github.com/astaxie/beego for the canonical source repository 7 // http://www.apache.org/licenses/LICENSE-2.0
6 // 8 //
7 // @license http://github.com/astaxie/beego/blob/master/LICENSE 9 // Unless required by applicable law or agreed to in writing, software
8 // 10 // distributed under the License is distributed on an "AS IS" BASIS,
9 // @authors astaxie 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14
10 package session 15 package session
11 16
12 import ( 17 import (
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!