Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
张磊
/
FileStorageBeego
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
724137e6
authored
2014-08-18 16:42:16 +0800
by
astaxie
Browse Files
Options
Browse Files
Tag
Download
Plain Diff
Merge branch 'master' into develop
2 parents
05089be4
a1447695
Hide whitespace changes
Inline
Side-by-side
Showing
143 changed files
with
1911 additions
and
908 deletions
README.md
admin.go
adminui.go
app.go
beego.go
cache/cache.go
cache/cache_test.go
cache/conv.go
cache/conv_test.go
cache/file.go
cache/memcache/memcache.go
cache/memory.go
cache/redis/redis.go
cache/redis/redis_test.go
config.go
config/config.go
config/fake.go
config/ini.go
config/ini_test.go
config/json.go
config/json_test.go
config/xml/xml.go
config/xml/xml_test.go
config/yaml/yaml.go
config/yaml/yaml_test.go
config_test.go
context/context.go
context/input.go
context/input_test.go
context/output.go
controller.go
docs.go
filter.go
filter_test.go
flash.go
flash_test.go
httplib/httplib.go
httplib/httplib_test.go
log.go
logs/conn.go
logs/conn_test.go
logs/console.go
logs/console_test.go
logs/file.go
logs/file_test.go
logs/log.go
logs/smtp.go
logs/smtp_test.go
memzipfile.go
middleware/error.go
middleware/exceptions.go
middleware/i18n.go
migration/migration.go
mime.go
namespace.go
namespace_test.go
orm/README.md
orm/cmd.go
orm/cmd_utils.go
orm/db.go
orm/db_alias.go
orm/db_mysql.go
orm/db_oracle.go
orm/db_postgres.go
orm/db_sqlite.go
orm/db_tables.go
orm/db_utils.go
orm/models.go
orm/models_boot.go
orm/models_fields.go
orm/models_info_f.go
orm/models_info_m.go
orm/models_test.go
orm/models_utils.go
orm/orm.go
orm/orm_conds.go
orm/orm_log.go
orm/orm_object.go
orm/orm_querym2m.go
orm/orm_queryset.go
orm/orm_raw.go
orm/orm_test.go
orm/types.go
orm/utils.go
parser.go
plugins/auth/basic.go
plugins/cors/cors.go
plugins/cors/cors_test.go
router.go
router_test.go
session/couchbase/sess_couchbase.go
session/memcache/sess_memcache.go
session/mysql/sess_mysql.go
session/postgres/sess_postgresql.go
session/redis/sess_redis.go
session/sess_cookie.go
session/sess_cookie_test.go
session/sess_file.go
session/sess_mem.go
session/sess_mem_test.go
session/sess_test.go
session/sess_utils.go
session/session.go
staticfile.go
swagger/docsSpec.go
template.go
template_test.go
templatefunc.go
templatefunc_test.go
testing/assertions.go
testing/client.go
toolbox/healthcheck.go
toolbox/profile.go
toolbox/profile_test.go
toolbox/statistics.go
toolbox/statistics_test.go
toolbox/task.go
toolbox/task_test.go
tree.go
tree_test.go
utils/caller.go
utils/caller_test.go
utils/captcha/captcha.go
utils/captcha/image.go
utils/captcha/image_test.go
utils/captcha/siprng.go
utils/captcha/siprng_test.go
utils/debug.go
utils/debug_test.go
utils/file.go
utils/file_test.go
utils/mail.go
utils/mail_test.go
utils/rand.go
utils/safemap.go
utils/safemap_test.go
utils/slice.go
utils/slice_test.go
validation/util.go
validation/util_test.go
validation/validation.go
validation/validation_test.go
validation/validators.go
README.md
View file @
724137e
...
...
@@ -2,9 +2,7 @@
[

](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://go
walker
.org/github.com/astaxie/beego
)
[
API
](
http://go
doc
.org/github.com/astaxie/beego
)
[
中文文档
](
http://beego.me/docs/intro/
)
...
...
admin.go
View file @
724137e
//
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
(
...
...
adminui.go
View file @
724137e
//
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
=
`
...
...
app.go
View file @
724137e
//
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
(
...
...
beego.go
View file @
724137e
//
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
//
// package main
//
// import "github.com/astaxie/beego"
//
// func main() {
// beego.Run()
// }
//
//
@authors astaxi
e
//
more infomation: http://beego.m
e
package
beego
import
(
...
...
cache/cache.go
View file @
724137e
//
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/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")
//
//
@authors astaxie
//
more docs http://beego.me/docs/module/cache.md
package
cache
import
(
...
...
cache/cache_test.go
View file @
724137e
//
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
(
...
...
cache/conv.go
View file @
724137e
//
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
(
...
...
cache/conv_test.go
View file @
724137e
//
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
(
...
...
cache/file.go
View file @
724137e
//
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
(
...
...
cache/memcache/memcache.go
View file @
724137e
//
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
//
// 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"}`)
//
//
@authors astaxie
//
more docs http://beego.me/docs/module/cache.md
package
memcache
import
(
...
...
cache/memory.go
View file @
724137e
//
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
(
...
...
cache/redis/redis.go
View file @
724137e
//
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
//
// 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"}`)
//
//
@authors astaxie
//
more docs http://beego.me/docs/module/cache.md
package
redis
import
(
...
...
cache/redis/redis_test.go
View file @
724137e
// 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
...
...
config.go
View file @
724137e
//
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
(
...
...
config/config.go
View file @
724137e
//
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"
// )
//
// 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
//
//
@authors astaxie
//
more docs http://beego.me/docs/module/config.md
package
config
import
(
...
...
config/fake.go
View file @
724137e
//
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
(
...
...
config/ini.go
View file @
724137e
//
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
(
...
...
config/ini_test.go
View file @
724137e
//
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
(
...
...
config/json.go
View file @
724137e
//
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
(
...
...
config/json_test.go
View file @
724137e
//
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
(
...
...
config/xml/xml.go
View file @
724137e
//
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
//
// 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")
//
//
@authors astaxie
//
more docs http://beego.me/docs/module/config.md
package
xml
import
(
...
...
config/xml/xml_test.go
View file @
724137e
//
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
(
...
...
config/yaml/yaml.go
View file @
724137e
//
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
//
// 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")
//
//
@authors astaxie
//
more docs http://beego.me/docs/module/config.md
package
yaml
import
(
...
...
config/yaml/yaml_test.go
View file @
724137e
//
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
(
...
...
config_test.go
View file @
724137e
//
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
(
...
...
context/context.go
View file @
724137e
//
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/context"
//
// ctx := context.Context{Request:req,ResponseWriter:rw}
//
//
@authors astaxie
//
more docs http://beego.me/docs/module/context.md
package
context
import
(
...
...
context/input.go
View file @
724137e
//
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
(
...
...
context/input_test.go
View file @
724137e
//
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
(
...
...
context/output.go
View file @
724137e
//
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
(
...
...
controller.go
View file @
724137e
//
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
(
...
...
docs.go
View file @
724137e
//
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
(
...
...
filter.go
View file @
724137e
//
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.
...
...
filter_test.go
View file @
724137e
//
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
(
...
...
flash.go
View file @
724137e
//
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
(
...
...
flash_test.go
View file @
724137e
//
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
(
...
...
httplib/httplib.go
View file @
724137e
//
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/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)
//
//
@authors astaxie
//
more docs http://beego.me/docs/module/httplib.md
package
httplib
import
(
...
...
httplib/httplib_test.go
View file @
724137e
//
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
(
...
...
log.go
View file @
724137e
//
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
(
...
...
logs/conn.go
View file @
724137e
//
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
(
...
...
logs/conn_test.go
View file @
724137e
//
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
(
...
...
logs/console.go
View file @
724137e
//
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
(
...
...
logs/console_test.go
View file @
724137e
//
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
(
...
...
logs/file.go
View file @
724137e
//
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
(
...
...
logs/file_test.go
View file @
724137e
//
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
(
...
...
logs/log.go
View file @
724137e
//
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/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")
//
//
@authors astaxie
//
more docs http://beego.me/docs/module/logs.md
package
logs
import
(
...
...
logs/smtp.go
View file @
724137e
//
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"
...
...
logs/smtp_test.go
View file @
724137e
//
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
(
...
...
memzipfile.go
View file @
724137e
//
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
(
...
...
middleware/error.go
View file @
724137e
//
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
(
...
...
middleware/exceptions.go
View file @
724137e
//
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"
...
...
middleware/i18n.go
View file @
724137e
//
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/middleware"
//
// I18N = middleware.NewLocale("conf/i18n.conf", beego.AppConfig.String("language"))
//
//
@authors astaxie
//
more docs: http://beego.me/docs/module/i18n.md
package
middleware
import
(
...
...
migration/migration.go
View file @
724137e
//
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',
...
...
mime.go
View file @
724137e
//
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
(
...
...
namespace.go
View file @
724137e
//
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
(
...
...
namespace_test.go
View file @
724137e
//
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
(
...
...
orm/README.md
View file @
724137e
...
...
@@ -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
...
...
orm/cmd.go
View file @
724137e
//
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
(
...
...
orm/cmd_utils.go
View file @
724137e
//
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
(
...
...
orm/db.go
View file @
724137e
//
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
(
...
...
orm/db_alias.go
View file @
724137e
//
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
(
...
...
orm/db_mysql.go
View file @
724137e
//
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
(
...
...
orm/db_oracle.go
View file @
724137e
//
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
...
...
orm/db_postgres.go
View file @
724137e
//
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
(
...
...
orm/db_sqlite.go
View file @
724137e
//
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
(
...
...
orm/db_tables.go
View file @
724137e
//
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
(
...
...
orm/db_utils.go
View file @
724137e
//
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
(
...
...
orm/models.go
View file @
724137e
//
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
(
...
...
orm/models_boot.go
View file @
724137e
//
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
(
...
...
orm/models_fields.go
View file @
724137e
//
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
(
...
...
orm/models_info_f.go
View file @
724137e
//
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
(
...
...
orm/models_info_m.go
View file @
724137e
//
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
(
...
...
orm/models_test.go
View file @
724137e
//
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
(
...
...
orm/models_utils.go
View file @
724137e
//
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
(
...
...
orm/orm.go
View file @
724137e
//
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
//
// 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)
// }
//
//
@authors astaxie, slene
//
more docs: http://beego.me/docs/mvc/model/overview.md
package
orm
import
(
...
...
orm/orm_conds.go
View file @
724137e
//
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
(
...
...
orm/orm_log.go
View file @
724137e
//
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
(
...
...
orm/orm_object.go
View file @
724137e
//
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
(
...
...
orm/orm_querym2m.go
View file @
724137e
//
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
(
...
...
orm/orm_queryset.go
View file @
724137e
//
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
(
...
...
orm/orm_raw.go
View file @
724137e
//
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
(
...
...
orm/orm_test.go
View file @
724137e
//
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
(
...
...
orm/types.go
View file @
724137e
//
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
(
...
...
orm/utils.go
View file @
724137e
//
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
(
...
...
parser.go
View file @
724137e
//
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
(
...
...
plugins/auth/basic.go
View file @
724137e
...
...
@@ -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
(
...
...
plugins/cors/cors.go
View file @
724137e
...
...
@@ -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
(
...
...
plugins/cors/cors_test.go
View file @
724137e
...
...
@@ -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
(
...
...
router.go
View file @
724137e
//
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
(
...
...
router_test.go
View file @
724137e
//
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
(
...
...
session/couchbase/sess_couchbase.go
View file @
724137e
//
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
//
// 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()
// }
//
//
@authors astaxie
//
more docs: http://beego.me/docs/module/session.md
package
session
import
(
...
...
session/memcache/sess_memcache.go
View file @
724137e
//
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
//
// 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()
// }
//
//
@authors astaxie
//
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
{
...
...
session/mysql/sess_mysql.go
View file @
724137e
//
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&...¶mN=valueN]"}``)
// go globalSessions.GC()
// }
//
// more docs: http://beego.me/docs/module/session.md
package
session
import
(
"database/sql"
...
...
session/postgres/sess_postgresql.go
View file @
724137e
//
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
//
// depends on github.com/lib/pq:
//
// go install github.com/lib/pq
//
//
// needs this table in your database:
//
// @authors astaxie
// 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"
...
...
session/redis/sess_redis.go
View file @
724137e
//
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
//
// 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()
// }
//
//
@authors astaxie
//
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
{}
...
...
session/sess_cookie.go
View file @
724137e
//
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
(
...
...
session/sess_cookie_test.go
View file @
724137e
//
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
(
...
...
session/sess_file.go
View file @
724137e
//
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
(
...
...
session/sess_mem.go
View file @
724137e
//
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
(
...
...
session/sess_mem_test.go
View file @
724137e
//
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
(
...
...
session/sess_test.go
View file @
724137e
//
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
(
...
...
session/sess_utils.go
View file @
724137e
//
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
(
...
...
session/session.go
View file @
724137e
//
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 session provider
//
// Usage:
// import(
// "github.com/astaxie/beego/session"
// )
//
// func init() {
// globalSessions, _ = session.NewManager("memory", `{"cookieName":"gosessionid", "enableSetCookie,omitempty": true, "gclifetime":3600, "maxLifetime": 3600, "secure": false, "sessionIDHashFunc": "sha1", "sessionIDHashKey": "", "cookieLifeTime": 3600, "providerConfig": ""}`)
// go globalSessions.GC()
// }
//
//
@authors astaxie
//
more docs: http://beego.me/docs/module/session.md
package
session
import
(
...
...
staticfile.go
View file @
724137e
//
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
(
...
...
swagger/docsSpec.go
View file @
724137e
//
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.
// swagger struct definition
package
swagger
const
SwaggerVersion
=
"1.2"
...
...
template.go
View file @
724137e
//
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
beego
// 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.
//@todo add template funcs
package
beego
import
(
"errors"
...
...
template_test.go
View file @
724137e
//
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
(
...
...
templatefunc.go
View file @
724137e
//
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
(
...
...
templatefunc_test.go
View file @
724137e
//
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
(
...
...
testing/assertions.go
View file @
724137e
//
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
testing
...
...
testing/client.go
View file @
724137e
//
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
testing
import
(
...
...
toolbox/healthcheck.go
View file @
724137e
//
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
toolbox
//type DatabaseCheck struct {
//}
// 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.
//func (dc *DatabaseCheck) Check() error {
// toolbox healthcheck
//
// type DatabaseCheck struct {
// }
//
// func (dc *DatabaseCheck) Check() error {
// if dc.isConnected() {
// return nil
// } else {
// return errors.New("can't connect database")
// }
//}
//AddHealthCheck("database",&DatabaseCheck{})
// }
// }
//
// AddHealthCheck("database",&DatabaseCheck{})
//
// more docs: http://beego.me/docs/module/toolbox.md
package
toolbox
// health checker map
var
AdminCheckList
map
[
string
]
HealthChecker
...
...
toolbox/profile.go
View file @
724137e
//
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
toolbox
import
(
...
...
toolbox/profile_test.go
View file @
724137e
//
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
toolbox
import
(
...
...
toolbox/statistics.go
View file @
724137e
//
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
toolbox
import
(
...
...
toolbox/statistics_test.go
View file @
724137e
//
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
toolbox
import
(
...
...
toolbox/task.go
View file @
724137e
//
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
toolbox
import
(
...
...
toolbox/task_test.go
View file @
724137e
//
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
toolbox
import
(
...
...
tree.go
View file @
724137e
//
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
(
...
...
tree_test.go
View file @
724137e
//
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
"testing"
...
...
utils/caller.go
View file @
724137e
//
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
utils
import
(
...
...
utils/caller_test.go
View file @
724137e
//
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
utils
import
(
...
...
utils/captcha/captcha.go
View file @
724137e
//
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
//
// @license http://github.com/astaxie/beego/blob/master/LICENSE
//
// @authors astaxie
// 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.
// an example for use captcha
//
// ```
...
...
@@ -224,7 +228,6 @@ func (c *Captcha) Verify(id string, challenge string) (success bool) {
return
true
}
// create a new captcha.Captcha
func
NewCaptcha
(
urlPrefix
string
,
store
cache
.
Cache
)
*
Captcha
{
cpt
:=
&
Captcha
{}
...
...
utils/captcha/image.go
View file @
724137e
//
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
captcha
import
(
...
...
utils/captcha/image_test.go
View file @
724137e
//
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
captcha
import
(
...
...
utils/captcha/siprng.go
View file @
724137e
//
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
captcha
import
(
...
...
utils/captcha/siprng_test.go
View file @
724137e
//
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
captcha
import
"testing"
...
...
utils/debug.go
View file @
724137e
//
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
utils
import
(
...
...
utils/debug_test.go
View file @
724137e
//
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
utils
import
(
...
...
utils/file.go
View file @
724137e
//
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
utils
import
(
...
...
utils/file_test.go
View file @
724137e
//
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
utils
import
(
...
...
utils/mail.go
View file @
724137e
//
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
utils
import
(
...
...
utils/mail_test.go
View file @
724137e
//
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
utils
import
"testing"
...
...
utils/rand.go
View file @
724137e
//
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
utils
import
(
...
...
utils/safemap.go
View file @
724137e
//
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
utils
import
(
...
...
utils/safemap_test.go
View file @
724137e
//
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
utils
import
(
...
...
utils/slice.go
View file @
724137e
//
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
utils
import
(
...
...
utils/slice_test.go
View file @
724137e
//
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
utils
import
(
...
...
validation/util.go
View file @
724137e
//
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
validation
import
(
...
...
validation/util_test.go
View file @
724137e
//
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
validation
import
(
...
...
validation/validation.go
View file @
724137e
//
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 for validations
//
// import (
// "github.com/astaxie/beego/validation"
// "log"
// )
//
// type User struct {
// Name string
// Age int
// }
//
// func main() {
// u := User{"man", 40}
// valid := validation.Validation{}
// valid.Required(u.Name, "name")
// valid.MaxSize(u.Name, 15, "nameMax")
// valid.Range(u.Age, 0, 140, "age")
// if valid.HasErrors() {
// // validation does not pass
// // print invalid message
// for _, err := range valid.Errors {
// log.Println(err.Key, err.Message)
// }
// }
// // or use like this
// if v := valid.Max(u.Age, 140); !v.Ok {
// log.Println(v.Error.Key, v.Error.Message)
// }
// }
//
//
@authors astaxie
//
more info: http://beego.me/docs/mvc/controller/validation.md
package
validation
import
(
...
...
validation/validation_test.go
View file @
724137e
//
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
validation
import
(
...
...
validation/validators.go
View file @
724137e
//
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
validation
import
(
...
...
Write
Preview
Styling with
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment