1
0
mirror of https://github.com/astaxie/beego.git synced 2024-11-22 12:30:54 +00:00

Merge branch 'master' into develop

This commit is contained in:
astaxie 2014-08-18 16:42:16 +08:00
commit 724137e605
143 changed files with 1911 additions and 908 deletions

View File

@ -2,9 +2,7 @@
[![Build Status](https://drone.io/github.com/astaxie/beego/status.png)](https://drone.io/github.com/astaxie/beego/latest)
beego is a Go Framework inspired by tornado and sinatra.
It is a simple & powerful web framework.
beego is an open-source, high-performance, modularity, full-stack web framework.
More info [beego.me](http://beego.me)
@ -12,20 +10,18 @@ More info [beego.me](http://beego.me)
* RESTful support
* MVC architecture
* Session support (store in memory, file, Redis or MySQL)
* Cache support (store in memory, Redis or Memcache)
* Global Config
* Intelligent routing
* Thread-safe map
* Friendly displaying of errors
* Useful template functions
* modularity
* auto API documents
* annotation router
* namespace
* powerful develop tools
* full stack for web & API
## Documentation
[English](http://beego.me/docs/intro/)
[API](http://gowalker.org/github.com/astaxie/beego)
[API](http://godoc.org/github.com/astaxie/beego)
[中文文档](http://beego.me/docs/intro/)

View File

@ -1,12 +1,17 @@
// Beego (http://beego.me/)
// Copyright 2014 beego Author. All Rights Reserved.
//
// @description beego is an open-source, high-performance web framework for the Go programming language.
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// @link http://github.com/astaxie/beego for the canonical source repository
// http://www.apache.org/licenses/LICENSE-2.0
//
// @license http://github.com/astaxie/beego/blob/master/LICENSE
//
// @authors astaxie
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package beego
import (

View File

@ -1,12 +1,17 @@
// Beego (http://beego.me/)
// Copyright 2014 beego Author. All Rights Reserved.
//
// @description beego is an open-source, high-performance web framework for the Go programming language.
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// @link http://github.com/astaxie/beego for the canonical source repository
// http://www.apache.org/licenses/LICENSE-2.0
//
// @license http://github.com/astaxie/beego/blob/master/LICENSE
//
// @authors astaxie
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package beego
var indexTpl = `

17
app.go
View File

@ -1,12 +1,17 @@
// Beego (http://beego.me/)
// Copyright 2014 beego Author. All Rights Reserved.
//
// @description beego is an open-source, high-performance web framework for the Go programming language.
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// @link http://github.com/astaxie/beego for the canonical source repository
// http://www.apache.org/licenses/LICENSE-2.0
//
// @license http://github.com/astaxie/beego/blob/master/LICENSE
//
// @authors astaxie
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package beego
import (

View File

@ -1,12 +1,28 @@
// Beego (http://beego.me/)
// Copyright 2014 beego Author. All Rights Reserved.
//
// @description beego is an open-source, high-performance web framework for the Go programming language.
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// @link http://github.com/astaxie/beego for the canonical source repository
// http://www.apache.org/licenses/LICENSE-2.0
//
// @license http://github.com/astaxie/beego/blob/master/LICENSE
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// beego is an open-source, high-performance, modularity, full-stack web framework
//
// @authors astaxie
// package main
//
// import "github.com/astaxie/beego"
//
// func main() {
// beego.Run()
// }
//
// more infomation: http://beego.me
package beego
import (

31
cache/cache.go vendored
View File

@ -1,12 +1,33 @@
// Beego (http://beego.me/)
// Copyright 2014 beego Author. All Rights Reserved.
//
// @description beego is an open-source, high-performance web framework for the Go programming language.
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// @link http://github.com/astaxie/beego for the canonical source repository
// http://www.apache.org/licenses/LICENSE-2.0
//
// @license http://github.com/astaxie/beego/blob/master/LICENSE
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Usage:
//
// @authors astaxie
// import(
// "github.com/astaxie/beego/cache"
// )
//
// bm, err := cache.NewCache("memory", `{"interval":60}`)
//
// Use it like this:
//
// bm.Put("astaxie", 1, 10)
// bm.Get("astaxie")
// bm.IsExist("astaxie")
// bm.Delete("astaxie")
//
// more docs http://beego.me/docs/module/cache.md
package cache
import (

17
cache/cache_test.go vendored
View File

@ -1,12 +1,17 @@
// Beego (http://beego.me/)
// Copyright 2014 beego Author. All Rights Reserved.
//
// @description beego is an open-source, high-performance web framework for the Go programming language.
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// @link http://github.com/astaxie/beego for the canonical source repository
// http://www.apache.org/licenses/LICENSE-2.0
//
// @license http://github.com/astaxie/beego/blob/master/LICENSE
//
// @authors astaxie
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package cache
import (

17
cache/conv.go vendored
View File

@ -1,12 +1,17 @@
// Beego (http://beego.me/)
// Copyright 2014 beego Author. All Rights Reserved.
//
// @description beego is an open-source, high-performance web framework for the Go programming language.
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// @link http://github.com/astaxie/beego for the canonical source repository
// http://www.apache.org/licenses/LICENSE-2.0
//
// @license http://github.com/astaxie/beego/blob/master/LICENSE
//
// @authors astaxie
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package cache
import (

17
cache/conv_test.go vendored
View File

@ -1,12 +1,17 @@
// Beego (http://beego.me/)
// Copyright 2014 beego Author. All Rights Reserved.
//
// @description beego is an open-source, high-performance web framework for the Go programming language.
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// @link http://github.com/astaxie/beego for the canonical source repository
// http://www.apache.org/licenses/LICENSE-2.0
//
// @license http://github.com/astaxie/beego/blob/master/LICENSE
//
// @authors astaxie
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package cache
import (

17
cache/file.go vendored
View File

@ -1,12 +1,17 @@
// Beego (http://beego.me/)
// Copyright 2014 beego Author. All Rights Reserved.
//
// @description beego is an open-source, high-performance web framework for the Go programming language.
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// @link http://github.com/astaxie/beego for the canonical source repository
// http://www.apache.org/licenses/LICENSE-2.0
//
// @license http://github.com/astaxie/beego/blob/master/LICENSE
//
// @authors astaxie
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package cache
import (

View File

@ -1,12 +1,32 @@
// Beego (http://beego.me/)
// Copyright 2014 beego Author. All Rights Reserved.
//
// @description beego is an open-source, high-performance web framework for the Go programming language.
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// @link http://github.com/astaxie/beego for the canonical source repository
// http://www.apache.org/licenses/LICENSE-2.0
//
// @license http://github.com/astaxie/beego/blob/master/LICENSE
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// package memcahe for cache provider
//
// @authors astaxie
// depend on github.com/bradfitz/gomemcache/memcache
//
// go install github.com/bradfitz/gomemcache/memcache
//
// Usage:
// import(
// _ "github.com/astaxie/beego/cache/memcache"
// "github.com/astaxie/beego/cache"
// )
//
// bm, err := cache.NewCache("memcache", `{"conn":"127.0.0.1:11211"}`)
//
// more docs http://beego.me/docs/module/cache.md
package memcache
import (

17
cache/memory.go vendored
View File

@ -1,12 +1,17 @@
// Beego (http://beego.me/)
// Copyright 2014 beego Author. All Rights Reserved.
//
// @description beego is an open-source, high-performance web framework for the Go programming language.
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// @link http://github.com/astaxie/beego for the canonical source repository
// http://www.apache.org/licenses/LICENSE-2.0
//
// @license http://github.com/astaxie/beego/blob/master/LICENSE
//
// @authors astaxie
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package cache
import (

30
cache/redis/redis.go vendored
View File

@ -1,12 +1,32 @@
// Beego (http://beego.me/)
// Copyright 2014 beego Author. All Rights Reserved.
//
// @description beego is an open-source, high-performance web framework for the Go programming language.
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// @link http://github.com/astaxie/beego for the canonical source repository
// http://www.apache.org/licenses/LICENSE-2.0
//
// @license http://github.com/astaxie/beego/blob/master/LICENSE
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// package redis for cache provider
//
// @authors astaxie
// depend on github.com/garyburd/redigo/redis
//
// go install github.com/garyburd/redigo/redis
//
// Usage:
// import(
// _ "github.com/astaxie/beego/cache/redis"
// "github.com/astaxie/beego/cache"
// )
//
// bm, err := cache.NewCache("redis", `{"conn":"127.0.0.1:11211"}`)
//
// more docs http://beego.me/docs/module/cache.md
package redis
import (

View File

@ -1,12 +1,16 @@
// Beego (http://beego.me/)
// @description beego is an open-source, high-performance web framework for the Go programming language.
// @link http://github.com/astaxie/beego for the canonical source repository
// @license http://github.com/astaxie/beego/blob/master/LICENSE
// @authors astaxie
// Copyright 2014 beego Author. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package redis

View File

@ -1,12 +1,17 @@
// Beego (http://beego.me/)
// Copyright 2014 beego Author. All Rights Reserved.
//
// @description beego is an open-source, high-performance web framework for the Go programming language.
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// @link http://github.com/astaxie/beego for the canonical source repository
// http://www.apache.org/licenses/LICENSE-2.0
//
// @license http://github.com/astaxie/beego/blob/master/LICENSE
//
// @authors astaxie
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package beego
import (

View File

@ -1,12 +1,44 @@
// Beego (http://beego.me/)
// Copyright 2014 beego Author. All Rights Reserved.
//
// @description beego is an open-source, high-performance web framework for the Go programming language.
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// @link http://github.com/astaxie/beego for the canonical source repository
// http://www.apache.org/licenses/LICENSE-2.0
//
// @license http://github.com/astaxie/beego/blob/master/LICENSE
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Usage:
// import(
// "github.com/astaxie/beego/config"
// )
//
// @authors astaxie
// cnf, err := config.NewConfig("ini", "config.conf")
//
// cnf APIS:
//
// cnf.Set(key, val string) error
// cnf.String(key string) string
// cnf.Strings(key string) []string
// cnf.Int(key string) (int, error)
// cnf.Int64(key string) (int64, error)
// cnf.Bool(key string) (bool, error)
// cnf.Float(key string) (float64, error)
// cnf.DefaultString(key string, defaultval string) string
// cnf.DefaultStrings(key string, defaultval []string) []string
// cnf.DefaultInt(key string, defaultval int) int
// cnf.DefaultInt64(key string, defaultval int64) int64
// cnf.DefaultBool(key string, defaultval bool) bool
// cnf.DefaultFloat(key string, defaultval float64) float64
// cnf.DIY(key string) (interface{}, error)
// cnf.GetSection(section string) (map[string]string, error)
// cnf.SaveConfigFile(filename string) error
//
// more docs http://beego.me/docs/module/config.md
package config
import (

View File

@ -1,12 +1,17 @@
// Beego (http://beego.me/)
// Copyright 2014 beego Author. All Rights Reserved.
//
// @description beego is an open-source, high-performance web framework for the Go programming language.
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// @link http://github.com/astaxie/beego for the canonical source repository
// http://www.apache.org/licenses/LICENSE-2.0
//
// @license http://github.com/astaxie/beego/blob/master/LICENSE
//
// @authors astaxie
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package config
import (

View File

@ -1,12 +1,17 @@
// Beego (http://beego.me/)
// Copyright 2014 beego Author. All Rights Reserved.
//
// @description beego is an open-source, high-performance web framework for the Go programming language.
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// @link http://github.com/astaxie/beego for the canonical source repository
// http://www.apache.org/licenses/LICENSE-2.0
//
// @license http://github.com/astaxie/beego/blob/master/LICENSE
//
// @authors astaxie
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package config
import (

View File

@ -1,12 +1,17 @@
// Beego (http://beego.me/)
// Copyright 2014 beego Author. All Rights Reserved.
//
// @description beego is an open-source, high-performance web framework for the Go programming language.
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// @link http://github.com/astaxie/beego for the canonical source repository
// http://www.apache.org/licenses/LICENSE-2.0
//
// @license http://github.com/astaxie/beego/blob/master/LICENSE
//
// @authors astaxie
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package config
import (

View File

@ -1,12 +1,17 @@
// Beego (http://beego.me/)
// Copyright 2014 beego Author. All Rights Reserved.
//
// @description beego is an open-source, high-performance web framework for the Go programming language.
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// @link http://github.com/astaxie/beego for the canonical source repository
// http://www.apache.org/licenses/LICENSE-2.0
//
// @license http://github.com/astaxie/beego/blob/master/LICENSE
//
// @authors astaxie
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package config
import (

View File

@ -1,12 +1,17 @@
// Beego (http://beego.me/)
// Copyright 2014 beego Author. All Rights Reserved.
//
// @description beego is an open-source, high-performance web framework for the Go programming language.
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// @link http://github.com/astaxie/beego for the canonical source repository
// http://www.apache.org/licenses/LICENSE-2.0
//
// @license http://github.com/astaxie/beego/blob/master/LICENSE
//
// @authors astaxie
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package config
import (

View File

@ -1,12 +1,32 @@
// Beego (http://beego.me/)
// Copyright 2014 beego Author. All Rights Reserved.
//
// @description beego is an open-source, high-performance web framework for the Go programming language.
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// @link http://github.com/astaxie/beego for the canonical source repository
// http://www.apache.org/licenses/LICENSE-2.0
//
// @license http://github.com/astaxie/beego/blob/master/LICENSE
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// package xml for config provider
//
// @authors astaxie
// depend on github.com/beego/x2j
//
// go install github.com/beego/x2j
//
// Usage:
// import(
// _ "github.com/astaxie/beego/config/xml"
// "github.com/astaxie/beego/config"
// )
//
// cnf, err := config.NewConfig("xml", "config.xml")
//
// more docs http://beego.me/docs/module/config.md
package xml
import (

View File

@ -1,12 +1,17 @@
// Beego (http://beego.me/)
// Copyright 2014 beego Author. All Rights Reserved.
//
// @description beego is an open-source, high-performance web framework for the Go programming language.
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// @link http://github.com/astaxie/beego for the canonical source repository
// http://www.apache.org/licenses/LICENSE-2.0
//
// @license http://github.com/astaxie/beego/blob/master/LICENSE
//
// @authors astaxie
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package xml
import (

View File

@ -1,12 +1,32 @@
// Beego (http://beego.me/)
// Copyright 2014 beego Author. All Rights Reserved.
//
// @description beego is an open-source, high-performance web framework for the Go programming language.
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// @link http://github.com/astaxie/beego for the canonical source repository
// http://www.apache.org/licenses/LICENSE-2.0
//
// @license http://github.com/astaxie/beego/blob/master/LICENSE
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// package yaml for config provider
//
// @authors astaxie
// depend on github.com/beego/goyaml2
//
// go install github.com/beego/goyaml2
//
// Usage:
// import(
// _ "github.com/astaxie/beego/config/yaml"
// "github.com/astaxie/beego/config"
// )
//
// cnf, err := config.NewConfig("yaml", "config.yaml")
//
// more docs http://beego.me/docs/module/config.md
package yaml
import (

View File

@ -1,12 +1,17 @@
// Beego (http://beego.me/)
// Copyright 2014 beego Author. All Rights Reserved.
//
// @description beego is an open-source, high-performance web framework for the Go programming language.
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// @link http://github.com/astaxie/beego for the canonical source repository
// http://www.apache.org/licenses/LICENSE-2.0
//
// @license http://github.com/astaxie/beego/blob/master/LICENSE
//
// @authors astaxie
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package yaml
import (

View File

@ -1,12 +1,17 @@
// Beego (http://beego.me/)
// Copyright 2014 beego Author. All Rights Reserved.
//
// @description beego is an open-source, high-performance web framework for the Go programming language.
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// @link http://github.com/astaxie/beego for the canonical source repository
// http://www.apache.org/licenses/LICENSE-2.0
//
// @license http://github.com/astaxie/beego/blob/master/LICENSE
//
// @authors astaxie
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package beego
import (

View File

@ -1,12 +1,24 @@
// Beego (http://beego.me/)
// Copyright 2014 beego Author. All Rights Reserved.
//
// @description beego is an open-source, high-performance web framework for the Go programming language.
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// @link http://github.com/astaxie/beego for the canonical source repository
// http://www.apache.org/licenses/LICENSE-2.0
//
// @license http://github.com/astaxie/beego/blob/master/LICENSE
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Usage:
//
// @authors astaxie
// import "github.com/astaxie/beego/context"
//
// ctx := context.Context{Request:req,ResponseWriter:rw}
//
// more docs http://beego.me/docs/module/context.md
package context
import (

View File

@ -1,12 +1,17 @@
// Beego (http://beego.me/)
// Copyright 2014 beego Author. All Rights Reserved.
//
// @description beego is an open-source, high-performance web framework for the Go programming language.
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// @link http://github.com/astaxie/beego for the canonical source repository
// http://www.apache.org/licenses/LICENSE-2.0
//
// @license http://github.com/astaxie/beego/blob/master/LICENSE
//
// @authors astaxie
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package context
import (

View File

@ -1,12 +1,17 @@
// Beego (http://beego.me/)
// Copyright 2014 beego Author. All Rights Reserved.
//
// @description beego is an open-source, high-performance web framework for the Go programming language.
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// @link http://github.com/astaxie/beego for the canonical source repository
// http://www.apache.org/licenses/LICENSE-2.0
//
// @license http://github.com/astaxie/beego/blob/master/LICENSE
//
// @authors astaxie
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package context
import (

View File

@ -1,12 +1,17 @@
// Beego (http://beego.me/)
// Copyright 2014 beego Author. All Rights Reserved.
//
// @description beego is an open-source, high-performance web framework for the Go programming language.
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// @link http://github.com/astaxie/beego for the canonical source repository
// http://www.apache.org/licenses/LICENSE-2.0
//
// @license http://github.com/astaxie/beego/blob/master/LICENSE
//
// @authors astaxie
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package context
import (

View File

@ -1,12 +1,17 @@
// Beego (http://beego.me/)
// Copyright 2014 beego Author. All Rights Reserved.
//
// @description beego is an open-source, high-performance web framework for the Go programming language.
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// @link http://github.com/astaxie/beego for the canonical source repository
// http://www.apache.org/licenses/LICENSE-2.0
//
// @license http://github.com/astaxie/beego/blob/master/LICENSE
//
// @authors astaxie
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package beego
import (

17
docs.go
View File

@ -1,12 +1,17 @@
// Beego (http://beego.me/)
// Copyright 2014 beego Author. All Rights Reserved.
//
// @description beego is an open-source, high-performance web framework for the Go programming language.
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// @link http://github.com/astaxie/beego for the canonical source repository
// http://www.apache.org/licenses/LICENSE-2.0
//
// @license http://github.com/astaxie/beego/blob/master/LICENSE
//
// @authors astaxie
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package beego
import (

View File

@ -1,12 +1,17 @@
// Beego (http://beego.me/)
// Copyright 2014 beego Author. All Rights Reserved.
//
// @description beego is an open-source, high-performance web framework for the Go programming language.
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// @link http://github.com/astaxie/beego for the canonical source repository
// http://www.apache.org/licenses/LICENSE-2.0
//
// @license http://github.com/astaxie/beego/blob/master/LICENSE
//
// @authors astaxie
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package beego
// FilterRouter defines filter operation before controller handler execution.

View File

@ -1,12 +1,17 @@
// Beego (http://beego.me/)
// Copyright 2014 beego Author. All Rights Reserved.
//
// @description beego is an open-source, high-performance web framework for the Go programming language.
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// @link http://github.com/astaxie/beego for the canonical source repository
// http://www.apache.org/licenses/LICENSE-2.0
//
// @license http://github.com/astaxie/beego/blob/master/LICENSE
//
// @authors astaxie
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package beego
import (

View File

@ -1,12 +1,17 @@
// Beego (http://beego.me/)
// Copyright 2014 beego Author. All Rights Reserved.
//
// @description beego is an open-source, high-performance web framework for the Go programming language.
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// @link http://github.com/astaxie/beego for the canonical source repository
// http://www.apache.org/licenses/LICENSE-2.0
//
// @license http://github.com/astaxie/beego/blob/master/LICENSE
//
// @authors astaxie
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package beego
import (

View File

@ -1,12 +1,17 @@
// Beego (http://beego.me/)
// Copyright 2014 beego Author. All Rights Reserved.
//
// @description beego is an open-source, high-performance web framework for the Go programming language.
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// @link http://github.com/astaxie/beego for the canonical source repository
// http://www.apache.org/licenses/LICENSE-2.0
//
// @license http://github.com/astaxie/beego/blob/master/LICENSE
//
// @authors astaxie
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package beego
import (

View File

@ -1,12 +1,33 @@
// Beego (http://beego.me/)
// Copyright 2014 beego Author. All Rights Reserved.
//
// @description beego is an open-source, high-performance web framework for the Go programming language.
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// @link http://github.com/astaxie/beego for the canonical source repository
// http://www.apache.org/licenses/LICENSE-2.0
//
// @license http://github.com/astaxie/beego/blob/master/LICENSE
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Usage:
//
// @authors astaxie
// import "github.com/astaxie/beego/context"
//
// b:=httplib.Post("http://beego.me/")
// b.Param("username","astaxie")
// b.Param("password","123456")
// b.PostFile("uploadfile1", "httplib.pdf")
// b.PostFile("uploadfile2", "httplib.txt")
// str, err := b.String()
// if err != nil {
// t.Fatal(err)
// }
// fmt.Println(str)
//
// more docs http://beego.me/docs/module/httplib.md
package httplib
import (

View File

@ -1,12 +1,17 @@
// Beego (http://beego.me/)
// Copyright 2014 beego Author. All Rights Reserved.
//
// @description beego is an open-source, high-performance web framework for the Go programming language.
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// @link http://github.com/astaxie/beego for the canonical source repository
// http://www.apache.org/licenses/LICENSE-2.0
//
// @license http://github.com/astaxie/beego/blob/master/LICENSE
//
// @authors astaxie
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package httplib
import (

17
log.go
View File

@ -1,12 +1,17 @@
// Beego (http://beego.me/)
// Copyright 2014 beego Author. All Rights Reserved.
//
// @description beego is an open-source, high-performance web framework for the Go programming language.
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// @link http://github.com/astaxie/beego for the canonical source repository
// http://www.apache.org/licenses/LICENSE-2.0
//
// @license http://github.com/astaxie/beego/blob/master/LICENSE
//
// @authors astaxie
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package beego
import (

View File

@ -1,12 +1,17 @@
// Beego (http://beego.me/)
// Copyright 2014 beego Author. All Rights Reserved.
//
// @description beego is an open-source, high-performance web framework for the Go programming language.
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// @link http://github.com/astaxie/beego for the canonical source repository
// http://www.apache.org/licenses/LICENSE-2.0
//
// @license http://github.com/astaxie/beego/blob/master/LICENSE
//
// @authors astaxie
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package logs
import (

View File

@ -1,12 +1,17 @@
// Beego (http://beego.me/)
// Copyright 2014 beego Author. All Rights Reserved.
//
// @description beego is an open-source, high-performance web framework for the Go programming language.
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// @link http://github.com/astaxie/beego for the canonical source repository
// http://www.apache.org/licenses/LICENSE-2.0
//
// @license http://github.com/astaxie/beego/blob/master/LICENSE
//
// @authors astaxie
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package logs
import (

View File

@ -1,12 +1,17 @@
// Beego (http://beego.me/)
// Copyright 2014 beego Author. All Rights Reserved.
//
// @description beego is an open-source, high-performance web framework for the Go programming language.
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// @link http://github.com/astaxie/beego for the canonical source repository
// http://www.apache.org/licenses/LICENSE-2.0
//
// @license http://github.com/astaxie/beego/blob/master/LICENSE
//
// @authors astaxie
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package logs
import (

View File

@ -1,12 +1,17 @@
// Beego (http://beego.me/)
// Copyright 2014 beego Author. All Rights Reserved.
//
// @description beego is an open-source, high-performance web framework for the Go programming language.
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// @link http://github.com/astaxie/beego for the canonical source repository
// http://www.apache.org/licenses/LICENSE-2.0
//
// @license http://github.com/astaxie/beego/blob/master/LICENSE
//
// @authors astaxie
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package logs
import (

View File

@ -1,12 +1,17 @@
// Beego (http://beego.me/)
// Copyright 2014 beego Author. All Rights Reserved.
//
// @description beego is an open-source, high-performance web framework for the Go programming language.
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// @link http://github.com/astaxie/beego for the canonical source repository
// http://www.apache.org/licenses/LICENSE-2.0
//
// @license http://github.com/astaxie/beego/blob/master/LICENSE
//
// @authors astaxie
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package logs
import (

View File

@ -1,12 +1,17 @@
// Beego (http://beego.me/)
// Copyright 2014 beego Author. All Rights Reserved.
//
// @description beego is an open-source, high-performance web framework for the Go programming language.
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// @link http://github.com/astaxie/beego for the canonical source repository
// http://www.apache.org/licenses/LICENSE-2.0
//
// @license http://github.com/astaxie/beego/blob/master/LICENSE
//
// @authors astaxie
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package logs
import (

View File

@ -1,12 +1,35 @@
// Beego (http://beego.me/)
// Copyright 2014 beego Author. All Rights Reserved.
//
// @description beego is an open-source, high-performance web framework for the Go programming language.
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// @link http://github.com/astaxie/beego for the canonical source repository
// http://www.apache.org/licenses/LICENSE-2.0
//
// @license http://github.com/astaxie/beego/blob/master/LICENSE
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Usage:
//
// @authors astaxie
// import "github.com/astaxie/beego/logs"
//
// log := NewLogger(10000)
// log.SetLogger("console", "")
//
// > the first params stand for how many channel
//
// Use it like this:
//
// log.Trace("trace")
// log.Info("info")
// log.Warn("warning")
// log.Debug("debug")
// log.Critical("critical")
//
// more docs http://beego.me/docs/module/logs.md
package logs
import (

View File

@ -1,12 +1,17 @@
// Beego (http://beego.me/)
// Copyright 2014 beego Author. All Rights Reserved.
//
// @description beego is an open-source, high-performance web framework for the Go programming language.
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// @link http://github.com/astaxie/beego for the canonical source repository
// http://www.apache.org/licenses/LICENSE-2.0
//
// @license http://github.com/astaxie/beego/blob/master/LICENSE
//
// @authors astaxie
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package logs
import (
@ -77,7 +82,7 @@ func (s *SmtpWriter) WriteMsg(msg string, level int) error {
// Set up authentication information.
auth := s.GetSmtpAuth(hp[0])
// Connect to the server, authenticate, set the sender and recipient,
// and send the email all in one step.
content_type := "Content-Type: text/plain" + "; charset=UTF-8"

View File

@ -1,12 +1,17 @@
// Beego (http://beego.me/)
// Copyright 2014 beego Author. All Rights Reserved.
//
// @description beego is an open-source, high-performance web framework for the Go programming language.
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// @link http://github.com/astaxie/beego for the canonical source repository
// http://www.apache.org/licenses/LICENSE-2.0
//
// @license http://github.com/astaxie/beego/blob/master/LICENSE
//
// @authors astaxie
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package logs
import (

View File

@ -1,12 +1,17 @@
// Beego (http://beego.me/)
// Copyright 2014 beego Author. All Rights Reserved.
//
// @description beego is an open-source, high-performance web framework for the Go programming language.
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// @link http://github.com/astaxie/beego for the canonical source repository
// http://www.apache.org/licenses/LICENSE-2.0
//
// @license http://github.com/astaxie/beego/blob/master/LICENSE
//
// @authors astaxie
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package beego
import (

View File

@ -1,12 +1,17 @@
// Beego (http://beego.me/)
// Copyright 2014 beego Author. All Rights Reserved.
//
// @description beego is an open-source, high-performance web framework for the Go programming language.
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// @link http://github.com/astaxie/beego for the canonical source repository
// http://www.apache.org/licenses/LICENSE-2.0
//
// @license http://github.com/astaxie/beego/blob/master/LICENSE
//
// @authors astaxie
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package middleware
import (

View File

@ -1,12 +1,17 @@
// Beego (http://beego.me/)
// Copyright 2014 beego Author. All Rights Reserved.
//
// @description beego is an open-source, high-performance web framework for the Go programming language.
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// @link http://github.com/astaxie/beego for the canonical source repository
// http://www.apache.org/licenses/LICENSE-2.0
//
// @license http://github.com/astaxie/beego/blob/master/LICENSE
//
// @authors astaxie
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package middleware
import "fmt"

View File

@ -1,12 +1,24 @@
// Beego (http://beego.me/)
// Copyright 2014 beego Author. All Rights Reserved.
//
// @description beego is an open-source, high-performance web framework for the Go programming language.
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// @link http://github.com/astaxie/beego for the canonical source repository
// http://www.apache.org/licenses/LICENSE-2.0
//
// @license http://github.com/astaxie/beego/blob/master/LICENSE
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Usage:
//
// @authors astaxie
// import "github.com/astaxie/beego/middleware"
//
// I18N = middleware.NewLocale("conf/i18n.conf", beego.AppConfig.String("language"))
//
// more docs: http://beego.me/docs/module/i18n.md
package middleware
import (

View File

@ -1,12 +1,20 @@
// Beego (http://beego.me/)
// Copyright 2014 beego Author. All Rights Reserved.
//
// @description beego is an open-source, high-performance web framework for the Go programming language.
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// @link http://github.com/astaxie/beego for the canonical source repository
// http://www.apache.org/licenses/LICENSE-2.0
//
// @license http://github.com/astaxie/beego/blob/master/LICENSE
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// migration package for migration
//
// @authors astaxie
// The table structure is as follow:
//
// CREATE TABLE `migrations` (
// `id_migration` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'surrogate key',

17
mime.go
View File

@ -1,12 +1,17 @@
// Beego (http://beego.me/)
// Copyright 2014 beego Author. All Rights Reserved.
//
// @description beego is an open-source, high-performance web framework for the Go programming language.
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// @link http://github.com/astaxie/beego for the canonical source repository
// http://www.apache.org/licenses/LICENSE-2.0
//
// @license http://github.com/astaxie/beego/blob/master/LICENSE
//
// @authors astaxie
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package beego
import (

View File

@ -1,12 +1,17 @@
// Beego (http://beego.me/)
// Copyright 2014 beego Author. All Rights Reserved.
//
// @description beego is an open-source, high-performance web framework for the Go programming language.
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// @link http://github.com/astaxie/beego for the canonical source repository
// http://www.apache.org/licenses/LICENSE-2.0
//
// @license http://github.com/astaxie/beego/blob/master/LICENSE
//
// @authors astaxie
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package beego
import (

View File

@ -1,12 +1,17 @@
// Beego (http://beego.me/)
// Copyright 2014 beego Author. All Rights Reserved.
//
// @description beego is an open-source, high-performance web framework for the Go programming language.
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// @link http://github.com/astaxie/beego for the canonical source repository
// http://www.apache.org/licenses/LICENSE-2.0
//
// @license http://github.com/astaxie/beego/blob/master/LICENSE
//
// @authors astaxie
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package beego
import (

View File

@ -154,10 +154,5 @@ note: not recommend use this in product env.
more details and examples in docs and test
* [中文](http://beego.me/docs/Models_Overview?lang=zh)
* [English](http://beego.me/docs/Models_Overview?lang=en)
[documents](http://beego.me/docs/mvc/model/overview.md)
## TODO
- some unrealized api
- examples
- docs

View File

@ -1,12 +1,17 @@
// Beego (http://beego.me/)
// Copyright 2014 beego Author. All Rights Reserved.
//
// @description beego is an open-source, high-performance web framework for the Go programming language.
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// @link http://github.com/astaxie/beego for the canonical source repository
// http://www.apache.org/licenses/LICENSE-2.0
//
// @license http://github.com/astaxie/beego/blob/master/LICENSE
//
// @authors astaxie, slene
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package orm
import (

View File

@ -1,12 +1,17 @@
// Beego (http://beego.me/)
// Copyright 2014 beego Author. All Rights Reserved.
//
// @description beego is an open-source, high-performance web framework for the Go programming language.
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// @link http://github.com/astaxie/beego for the canonical source repository
// http://www.apache.org/licenses/LICENSE-2.0
//
// @license http://github.com/astaxie/beego/blob/master/LICENSE
//
// @authors astaxie, slene
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package orm
import (

View File

@ -1,12 +1,17 @@
// Beego (http://beego.me/)
// Copyright 2014 beego Author. All Rights Reserved.
//
// @description beego is an open-source, high-performance web framework for the Go programming language.
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// @link http://github.com/astaxie/beego for the canonical source repository
// http://www.apache.org/licenses/LICENSE-2.0
//
// @license http://github.com/astaxie/beego/blob/master/LICENSE
//
// @authors astaxie, slene
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package orm
import (

View File

@ -1,12 +1,17 @@
// Beego (http://beego.me/)
// Copyright 2014 beego Author. All Rights Reserved.
//
// @description beego is an open-source, high-performance web framework for the Go programming language.
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// @link http://github.com/astaxie/beego for the canonical source repository
// http://www.apache.org/licenses/LICENSE-2.0
//
// @license http://github.com/astaxie/beego/blob/master/LICENSE
//
// @authors astaxie, slene
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package orm
import (

View File

@ -1,12 +1,17 @@
// Beego (http://beego.me/)
// Copyright 2014 beego Author. All Rights Reserved.
//
// @description beego is an open-source, high-performance web framework for the Go programming language.
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// @link http://github.com/astaxie/beego for the canonical source repository
// http://www.apache.org/licenses/LICENSE-2.0
//
// @license http://github.com/astaxie/beego/blob/master/LICENSE
//
// @authors astaxie, slene
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package orm
import (

View File

@ -1,12 +1,17 @@
// Beego (http://beego.me/)
// Copyright 2014 beego Author. All Rights Reserved.
//
// @description beego is an open-source, high-performance web framework for the Go programming language.
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// @link http://github.com/astaxie/beego for the canonical source repository
// http://www.apache.org/licenses/LICENSE-2.0
//
// @license http://github.com/astaxie/beego/blob/master/LICENSE
//
// @authors astaxie, slene
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package orm
// oracle dbBaser

View File

@ -1,12 +1,17 @@
// Beego (http://beego.me/)
// Copyright 2014 beego Author. All Rights Reserved.
//
// @description beego is an open-source, high-performance web framework for the Go programming language.
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// @link http://github.com/astaxie/beego for the canonical source repository
// http://www.apache.org/licenses/LICENSE-2.0
//
// @license http://github.com/astaxie/beego/blob/master/LICENSE
//
// @authors astaxie, slene
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package orm
import (

View File

@ -1,12 +1,17 @@
// Beego (http://beego.me/)
// Copyright 2014 beego Author. All Rights Reserved.
//
// @description beego is an open-source, high-performance web framework for the Go programming language.
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// @link http://github.com/astaxie/beego for the canonical source repository
// http://www.apache.org/licenses/LICENSE-2.0
//
// @license http://github.com/astaxie/beego/blob/master/LICENSE
//
// @authors astaxie, slene
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package orm
import (

View File

@ -1,12 +1,17 @@
// Beego (http://beego.me/)
// Copyright 2014 beego Author. All Rights Reserved.
//
// @description beego is an open-source, high-performance web framework for the Go programming language.
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// @link http://github.com/astaxie/beego for the canonical source repository
// http://www.apache.org/licenses/LICENSE-2.0
//
// @license http://github.com/astaxie/beego/blob/master/LICENSE
//
// @authors astaxie, slene
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package orm
import (

View File

@ -1,12 +1,17 @@
// Beego (http://beego.me/)
// Copyright 2014 beego Author. All Rights Reserved.
//
// @description beego is an open-source, high-performance web framework for the Go programming language.
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// @link http://github.com/astaxie/beego for the canonical source repository
// http://www.apache.org/licenses/LICENSE-2.0
//
// @license http://github.com/astaxie/beego/blob/master/LICENSE
//
// @authors astaxie, slene
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package orm
import (

View File

@ -1,12 +1,17 @@
// Beego (http://beego.me/)
// Copyright 2014 beego Author. All Rights Reserved.
//
// @description beego is an open-source, high-performance web framework for the Go programming language.
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// @link http://github.com/astaxie/beego for the canonical source repository
// http://www.apache.org/licenses/LICENSE-2.0
//
// @license http://github.com/astaxie/beego/blob/master/LICENSE
//
// @authors astaxie, slene
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package orm
import (

View File

@ -1,12 +1,17 @@
// Beego (http://beego.me/)
// Copyright 2014 beego Author. All Rights Reserved.
//
// @description beego is an open-source, high-performance web framework for the Go programming language.
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// @link http://github.com/astaxie/beego for the canonical source repository
// http://www.apache.org/licenses/LICENSE-2.0
//
// @license http://github.com/astaxie/beego/blob/master/LICENSE
//
// @authors astaxie, slene
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package orm
import (

View File

@ -1,12 +1,17 @@
// Beego (http://beego.me/)
// Copyright 2014 beego Author. All Rights Reserved.
//
// @description beego is an open-source, high-performance web framework for the Go programming language.
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// @link http://github.com/astaxie/beego for the canonical source repository
// http://www.apache.org/licenses/LICENSE-2.0
//
// @license http://github.com/astaxie/beego/blob/master/LICENSE
//
// @authors astaxie, slene
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package orm
import (

View File

@ -1,12 +1,17 @@
// Beego (http://beego.me/)
// Copyright 2014 beego Author. All Rights Reserved.
//
// @description beego is an open-source, high-performance web framework for the Go programming language.
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// @link http://github.com/astaxie/beego for the canonical source repository
// http://www.apache.org/licenses/LICENSE-2.0
//
// @license http://github.com/astaxie/beego/blob/master/LICENSE
//
// @authors astaxie, slene
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package orm
import (

View File

@ -1,12 +1,17 @@
// Beego (http://beego.me/)
// Copyright 2014 beego Author. All Rights Reserved.
//
// @description beego is an open-source, high-performance web framework for the Go programming language.
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// @link http://github.com/astaxie/beego for the canonical source repository
// http://www.apache.org/licenses/LICENSE-2.0
//
// @license http://github.com/astaxie/beego/blob/master/LICENSE
//
// @authors astaxie, slene
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package orm
import (

View File

@ -1,12 +1,17 @@
// Beego (http://beego.me/)
// Copyright 2014 beego Author. All Rights Reserved.
//
// @description beego is an open-source, high-performance web framework for the Go programming language.
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// @link http://github.com/astaxie/beego for the canonical source repository
// http://www.apache.org/licenses/LICENSE-2.0
//
// @license http://github.com/astaxie/beego/blob/master/LICENSE
//
// @authors astaxie, slene
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package orm
import (

View File

@ -1,12 +1,17 @@
// Beego (http://beego.me/)
// Copyright 2014 beego Author. All Rights Reserved.
//
// @description beego is an open-source, high-performance web framework for the Go programming language.
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// @link http://github.com/astaxie/beego for the canonical source repository
// http://www.apache.org/licenses/LICENSE-2.0
//
// @license http://github.com/astaxie/beego/blob/master/LICENSE
//
// @authors astaxie, slene
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package orm
import (

View File

@ -1,12 +1,53 @@
// Beego (http://beego.me/)
// Copyright 2014 beego Author. All Rights Reserved.
//
// @description beego is an open-source, high-performance web framework for the Go programming language.
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// @link http://github.com/astaxie/beego for the canonical source repository
// http://www.apache.org/licenses/LICENSE-2.0
//
// @license http://github.com/astaxie/beego/blob/master/LICENSE
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Simple Usage
//
// @authors astaxie, slene
// package main
//
// import (
// "fmt"
// "github.com/astaxie/beego/orm"
// _ "github.com/go-sql-driver/mysql" // import your used driver
// )
//
// // Model Struct
// type User struct {
// Id int `orm:"auto"`
// Name string `orm:"size(100)"`
// }
//
// func init() {
// orm.RegisterDataBase("default", "mysql", "root:root@/my_db?charset=utf8", 30)
// }
//
// func main() {
// o := orm.NewOrm()
// user := User{Name: "slene"}
// // insert
// id, err := o.Insert(&user)
// // update
// user.Name = "astaxie"
// num, err := o.Update(&user)
// // read one
// u := User{Id: user.Id}
// err = o.Read(&u)
// // delete
// num, err = o.Delete(&u)
// }
//
// more docs: http://beego.me/docs/mvc/model/overview.md
package orm
import (

View File

@ -1,12 +1,17 @@
// Beego (http://beego.me/)
// Copyright 2014 beego Author. All Rights Reserved.
//
// @description beego is an open-source, high-performance web framework for the Go programming language.
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// @link http://github.com/astaxie/beego for the canonical source repository
// http://www.apache.org/licenses/LICENSE-2.0
//
// @license http://github.com/astaxie/beego/blob/master/LICENSE
//
// @authors astaxie, slene
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package orm
import (

View File

@ -1,12 +1,17 @@
// Beego (http://beego.me/)
// Copyright 2014 beego Author. All Rights Reserved.
//
// @description beego is an open-source, high-performance web framework for the Go programming language.
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// @link http://github.com/astaxie/beego for the canonical source repository
// http://www.apache.org/licenses/LICENSE-2.0
//
// @license http://github.com/astaxie/beego/blob/master/LICENSE
//
// @authors astaxie, slene
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package orm
import (

View File

@ -1,12 +1,17 @@
// Beego (http://beego.me/)
// Copyright 2014 beego Author. All Rights Reserved.
//
// @description beego is an open-source, high-performance web framework for the Go programming language.
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// @link http://github.com/astaxie/beego for the canonical source repository
// http://www.apache.org/licenses/LICENSE-2.0
//
// @license http://github.com/astaxie/beego/blob/master/LICENSE
//
// @authors astaxie, slene
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package orm
import (

View File

@ -1,12 +1,17 @@
// Beego (http://beego.me/)
// Copyright 2014 beego Author. All Rights Reserved.
//
// @description beego is an open-source, high-performance web framework for the Go programming language.
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// @link http://github.com/astaxie/beego for the canonical source repository
// http://www.apache.org/licenses/LICENSE-2.0
//
// @license http://github.com/astaxie/beego/blob/master/LICENSE
//
// @authors astaxie, slene
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package orm
import (

View File

@ -1,12 +1,17 @@
// Beego (http://beego.me/)
// Copyright 2014 beego Author. All Rights Reserved.
//
// @description beego is an open-source, high-performance web framework for the Go programming language.
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// @link http://github.com/astaxie/beego for the canonical source repository
// http://www.apache.org/licenses/LICENSE-2.0
//
// @license http://github.com/astaxie/beego/blob/master/LICENSE
//
// @authors astaxie, slene
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package orm
import (

View File

@ -1,12 +1,17 @@
// Beego (http://beego.me/)
// Copyright 2014 beego Author. All Rights Reserved.
//
// @description beego is an open-source, high-performance web framework for the Go programming language.
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// @link http://github.com/astaxie/beego for the canonical source repository
// http://www.apache.org/licenses/LICENSE-2.0
//
// @license http://github.com/astaxie/beego/blob/master/LICENSE
//
// @authors astaxie, slene
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package orm
import (

View File

@ -1,12 +1,17 @@
// Beego (http://beego.me/)
// Copyright 2014 beego Author. All Rights Reserved.
//
// @description beego is an open-source, high-performance web framework for the Go programming language.
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// @link http://github.com/astaxie/beego for the canonical source repository
// http://www.apache.org/licenses/LICENSE-2.0
//
// @license http://github.com/astaxie/beego/blob/master/LICENSE
//
// @authors astaxie, slene
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package orm
import (

View File

@ -1,12 +1,17 @@
// Beego (http://beego.me/)
// Copyright 2014 beego Author. All Rights Reserved.
//
// @description beego is an open-source, high-performance web framework for the Go programming language.
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// @link http://github.com/astaxie/beego for the canonical source repository
// http://www.apache.org/licenses/LICENSE-2.0
//
// @license http://github.com/astaxie/beego/blob/master/LICENSE
//
// @authors astaxie, slene
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package orm
import (

View File

@ -1,12 +1,17 @@
// Beego (http://beego.me/)
// Copyright 2014 beego Author. All Rights Reserved.
//
// @description beego is an open-source, high-performance web framework for the Go programming language.
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// @link http://github.com/astaxie/beego for the canonical source repository
// http://www.apache.org/licenses/LICENSE-2.0
//
// @license http://github.com/astaxie/beego/blob/master/LICENSE
//
// @authors astaxie, slene
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package orm
import (

View File

@ -1,12 +1,17 @@
// Beego (http://beego.me/)
// Copyright 2014 beego Author. All Rights Reserved.
//
// @description beego is an open-source, high-performance web framework for the Go programming language.
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// @link http://github.com/astaxie/beego for the canonical source repository
// http://www.apache.org/licenses/LICENSE-2.0
//
// @license http://github.com/astaxie/beego/blob/master/LICENSE
//
// @authors astaxie
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package beego
import (

View File

@ -27,11 +27,11 @@
//
//
// Advanced Usage:
// func SecretAuth(username, password string) bool {
// return username == "astaxie" && password == "helloBeego"
// }
// authPlugin := auth.NewBasicAuthenticator(SecretAuth, "Authorization Required")
// beego.InsertFilter("*", beego.BeforeRouter,authPlugin)
// func SecretAuth(username, password string) bool {
// return username == "astaxie" && password == "helloBeego"
// }
// authPlugin := auth.NewBasicAuthenticator(SecretAuth, "Authorization Required")
// beego.InsertFilter("*", beego.BeforeRouter,authPlugin)
package auth
import (

View File

@ -14,26 +14,25 @@
// Package cors provides handlers to enable CORS support.
// Usage
//
// import (
// "github.com/astaxie/beego"
// "github.com/astaxie/beego/plugins/cors"
// import (
// "github.com/astaxie/beego"
// "github.com/astaxie/beego/plugins/cors"
// )
//func main() {
// // CORS for https://foo.* origins, allowing:
// // - PUT and PATCH methods
// // - Origin header
// // - Credentials share
// beego.InsertFilter("*", beego.BeforeRouter,cors.Allow(&cors.Options{
// AllowOrigins: []string{"https://*.foo.com"},
// AllowMethods: []string{"PUT", "PATCH"},
// AllowHeaders: []string{"Origin"},
// ExposeHeaders: []string{"Content-Length"},
// AllowCredentials: true,
// }))
// beego.Run()
//}
//
// func main() {
// // CORS for https://foo.* origins, allowing:
// // - PUT and PATCH methods
// // - Origin header
// // - Credentials share
// beego.InsertFilter("*", beego.BeforeRouter,cors.Allow(&cors.Options{
// AllowOrigins: []string{"https://*.foo.com"},
// AllowMethods: []string{"PUT", "PATCH"},
// AllowHeaders: []string{"Origin"},
// ExposeHeaders: []string{"Content-Length"},
// AllowCredentials: true,
// }))
// beego.Run()
// }
package cors
import (

View File

@ -12,7 +12,6 @@
// See the License for the specific language governing permissions and
// limitations under the License.
// Package cors provides handlers to enable CORS support.
package cors
import (

View File

@ -1,12 +1,17 @@
// Beego (http://beego.me/)
// Copyright 2014 beego Author. All Rights Reserved.
//
// @description beego is an open-source, high-performance web framework for the Go programming language.
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// @link http://github.com/astaxie/beego for the canonical source repository
// http://www.apache.org/licenses/LICENSE-2.0
//
// @license http://github.com/astaxie/beego/blob/master/LICENSE
//
// @authors astaxie
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package beego
import (

View File

@ -1,12 +1,17 @@
// Beego (http://beego.me/)
// Copyright 2014 beego Author. All Rights Reserved.
//
// @description beego is an open-source, high-performance web framework for the Go programming language.
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// @link http://github.com/astaxie/beego for the canonical source repository
// http://www.apache.org/licenses/LICENSE-2.0
//
// @license http://github.com/astaxie/beego/blob/master/LICENSE
//
// @authors astaxie
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package beego
import (

View File

@ -1,12 +1,35 @@
// Beego (http://beego.me/)
// Copyright 2014 beego Author. All Rights Reserved.
//
// @description beego is an open-source, high-performance web framework for the Go programming language.
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// @link http://github.com/astaxie/beego for the canonical source repository
// http://www.apache.org/licenses/LICENSE-2.0
//
// @license http://github.com/astaxie/beego/blob/master/LICENSE
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// package couchbase for session provider
//
// @authors astaxie
// depend on github.com/couchbaselabs/go-couchbasee
//
// go install github.com/couchbaselabs/go-couchbase
//
// Usage:
// import(
// _ "github.com/astaxie/beego/session/couchbase"
// "github.com/astaxie/beego/session"
// )
//
// func init() {
// globalSessions, _ = session.NewManager("couchbase", ``{"cookieName":"gosessionid","gclifetime":3600,"ProviderConfig":"http://host:port/, Pool, Bucket"}``)
// go globalSessions.GC()
// }
//
// more docs: http://beego.me/docs/module/session.md
package session
import (

View File

@ -1,12 +1,35 @@
// Beego (http://beego.me/)
// Copyright 2014 beego Author. All Rights Reserved.
//
// @description beego is an open-source, high-performance web framework for the Go programming language.
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// @link http://github.com/astaxie/beego for the canonical source repository
// http://www.apache.org/licenses/LICENSE-2.0
//
// @license http://github.com/astaxie/beego/blob/master/LICENSE
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// package memcache for session provider
//
// @authors astaxie
// depend on github.com/bradfitz/gomemcache/memcache
//
// go install github.com/bradfitz/gomemcache/memcache
//
// Usage:
// import(
// _ "github.com/astaxie/beego/session/memcache"
// "github.com/astaxie/beego/session"
// )
//
// func init() {
// globalSessions, _ = session.NewManager("memcache", ``{"cookieName":"gosessionid","gclifetime":3600,"ProviderConfig":"127.0.0.1:11211"}``)
// go globalSessions.GC()
// }
//
// more docs: http://beego.me/docs/module/session.md
package session
import (
@ -65,12 +88,12 @@ func (rs *MemcacheSessionStore) Flush() error {
return nil
}
// get redis session id
// get memcache session id
func (rs *MemcacheSessionStore) SessionID() string {
return rs.sid
}
// save session values to redis
// save session values to memcache
func (rs *MemcacheSessionStore) SessionRelease(w http.ResponseWriter) {
b, err := session.EncodeGob(rs.values)
if err != nil {
@ -80,7 +103,7 @@ func (rs *MemcacheSessionStore) SessionRelease(w http.ResponseWriter) {
client.Set(&item)
}
// redis session provider
// memcahe session provider
type MemProvider struct {
maxlifetime int64
conninfo []string
@ -88,7 +111,7 @@ type MemProvider struct {
password string
}
// init redis session
// init memcache session
// savepath like
// e.g. 127.0.0.1:9090
func (rp *MemProvider) SessionInit(maxlifetime int64, savePath string) error {
@ -98,7 +121,7 @@ func (rp *MemProvider) SessionInit(maxlifetime int64, savePath string) error {
return nil
}
// read redis session by sid
// read memcache session by sid
func (rp *MemProvider) SessionRead(sid string) (session.SessionStore, error) {
if client == nil {
if err := rp.connectInit(); err != nil {
@ -123,7 +146,7 @@ func (rp *MemProvider) SessionRead(sid string) (session.SessionStore, error) {
return rs, nil
}
// check redis session exist by sid
// check memcache session exist by sid
func (rp *MemProvider) SessionExist(sid string) bool {
if client == nil {
if err := rp.connectInit(); err != nil {
@ -137,7 +160,7 @@ func (rp *MemProvider) SessionExist(sid string) bool {
}
}
// generate new sid for redis session
// generate new sid for memcache session
func (rp *MemProvider) SessionRegenerate(oldsid, sid string) (session.SessionStore, error) {
if client == nil {
if err := rp.connectInit(); err != nil {
@ -177,7 +200,7 @@ func (rp *MemProvider) SessionRegenerate(oldsid, sid string) (session.SessionSto
return rs, nil
}
// delete redis session by id
// delete memcache session by id
func (rp *MemProvider) SessionDestroy(sid string) error {
if client == nil {
if err := rp.connectInit(); err != nil {

View File

@ -1,14 +1,23 @@
// Beego (http://beego.me/)
// Copyright 2014 beego Author. All Rights Reserved.
//
// @description beego is an open-source, high-performance web framework for the Go programming language.
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// @link http://github.com/astaxie/beego for the canonical source repository
// http://www.apache.org/licenses/LICENSE-2.0
//
// @license http://github.com/astaxie/beego/blob/master/LICENSE
//
// @authors astaxie
package session
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// package mysql for session provider
//
// depends on github.com/go-sql-driver/mysql:
//
// go install github.com/go-sql-driver/mysql
//
// mysql session support need create table as sql:
// CREATE TABLE `session` (
// `session_key` char(64) NOT NULL,
@ -16,6 +25,20 @@ package session
// `session_expiry` int(11) unsigned NOT NULL,
// PRIMARY KEY (`session_key`)
// ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
//
// Usage:
// import(
// _ "github.com/astaxie/beego/session/mysql"
// "github.com/astaxie/beego/session"
// )
//
// func init() {
// globalSessions, _ = session.NewManager("mysql", ``{"cookieName":"gosessionid","gclifetime":3600,"ProviderConfig":"[username[:password]@][protocol[(address)]]/dbname[?param1=value1&...&paramN=valueN]"}``)
// go globalSessions.GC()
// }
//
// more docs: http://beego.me/docs/module/session.md
package session
import (
"database/sql"

View File

@ -1,43 +1,55 @@
// Beego (http://beego.me/)
// Copyright 2014 beego Author. All Rights Reserved.
//
// @description beego is an open-source, high-performance web framework for the Go programming language.
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// @link http://github.com/astaxie/beego for the canonical source repository
// http://www.apache.org/licenses/LICENSE-2.0
//
// @license http://github.com/astaxie/beego/blob/master/LICENSE
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// package postgresql for session provider
//
// @authors astaxie
// depends on github.com/lib/pq:
//
// go install github.com/lib/pq
//
//
// needs this table in your database:
//
// CREATE TABLE session (
// session_key char(64) NOT NULL,
// session_data bytea,
// session_expiry timestamp NOT NULL,
// CONSTRAINT session_key PRIMARY KEY(session_key)
// );
// will be activated with these settings in app.conf:
// SessionOn = true
// SessionProvider = postgresql
// SessionSavePath = "user=a password=b dbname=c sslmode=disable"
// SessionName = session
//
//
// Usage:
// import(
// _ "github.com/astaxie/beego/session/postgresql"
// "github.com/astaxie/beego/session"
// )
//
// func init() {
// globalSessions, _ = session.NewManager("postgresql", ``{"cookieName":"gosessionid","gclifetime":3600,"ProviderConfig":"user=pqgotest dbname=pqgotest sslmode=verify-full"}``)
// go globalSessions.GC()
// }
//
// more docs: http://beego.me/docs/module/session.md
package session
/*
beego session provider for postgresql
-------------------------------------
depends on github.com/lib/pq:
go install github.com/lib/pq
needs this table in your database:
CREATE TABLE session (
session_key char(64) NOT NULL,
session_data bytea,
session_expiry timestamp NOT NULL,
CONSTRAINT session_key PRIMARY KEY(session_key)
);
will be activated with these settings in app.conf:
SessionOn = true
SessionProvider = postgresql
SessionSavePath = "user=a password=b dbname=c sslmode=disable"
SessionName = session
*/
import (
"database/sql"
"net/http"

View File

@ -1,12 +1,35 @@
// Beego (http://beego.me/)
// Copyright 2014 beego Author. All Rights Reserved.
//
// @description beego is an open-source, high-performance web framework for the Go programming language.
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// @link http://github.com/astaxie/beego for the canonical source repository
// http://www.apache.org/licenses/LICENSE-2.0
//
// @license http://github.com/astaxie/beego/blob/master/LICENSE
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// package redis for session provider
//
// @authors astaxie
// depend on github.com/garyburd/redigo/redis
//
// go install github.com/garyburd/redigo/redis
//
// Usage:
// import(
// _ "github.com/astaxie/beego/session/redis"
// "github.com/astaxie/beego/session"
// )
//
// func init() {
// globalSessions, _ = session.NewManager("redis", ``{"cookieName":"gosessionid","gclifetime":3600,"ProviderConfig":"127.0.0.1:7070"}``)
// go globalSessions.GC()
// }
//
// more docs: http://beego.me/docs/module/session.md
package session
import (
@ -17,7 +40,7 @@ import (
"github.com/astaxie/beego/session"
"github.com/beego/redigo/redis"
"github.com/garyburd/redigo/redis"
)
var redispder = &RedisProvider{}

View File

@ -1,12 +1,17 @@
// Beego (http://beego.me/)
// Copyright 2014 beego Author. All Rights Reserved.
//
// @description beego is an open-source, high-performance web framework for the Go programming language.
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// @link http://github.com/astaxie/beego for the canonical source repository
// http://www.apache.org/licenses/LICENSE-2.0
//
// @license http://github.com/astaxie/beego/blob/master/LICENSE
//
// @authors astaxie
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package session
import (

View File

@ -1,12 +1,17 @@
// Beego (http://beego.me/)
// Copyright 2014 beego Author. All Rights Reserved.
//
// @description beego is an open-source, high-performance web framework for the Go programming language.
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// @link http://github.com/astaxie/beego for the canonical source repository
// http://www.apache.org/licenses/LICENSE-2.0
//
// @license http://github.com/astaxie/beego/blob/master/LICENSE
//
// @authors astaxie
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package session
import (

View File

@ -1,12 +1,17 @@
// Beego (http://beego.me/)
// Copyright 2014 beego Author. All Rights Reserved.
//
// @description beego is an open-source, high-performance web framework for the Go programming language.
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// @link http://github.com/astaxie/beego for the canonical source repository
// http://www.apache.org/licenses/LICENSE-2.0
//
// @license http://github.com/astaxie/beego/blob/master/LICENSE
//
// @authors astaxie
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package session
import (

View File

@ -1,12 +1,17 @@
// Beego (http://beego.me/)
// Copyright 2014 beego Author. All Rights Reserved.
//
// @description beego is an open-source, high-performance web framework for the Go programming language.
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// @link http://github.com/astaxie/beego for the canonical source repository
// http://www.apache.org/licenses/LICENSE-2.0
//
// @license http://github.com/astaxie/beego/blob/master/LICENSE
//
// @authors astaxie
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package session
import (

View File

@ -1,12 +1,17 @@
// Beego (http://beego.me/)
// Copyright 2014 beego Author. All Rights Reserved.
//
// @description beego is an open-source, high-performance web framework for the Go programming language.
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// @link http://github.com/astaxie/beego for the canonical source repository
// http://www.apache.org/licenses/LICENSE-2.0
//
// @license http://github.com/astaxie/beego/blob/master/LICENSE
//
// @authors astaxie
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package session
import (

Some files were not shown because too many files have changed in this diff Show More