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
be30fb79
authored
2014-05-14 20:08:51 +0800
by
jessonchan
Committed by
astaxie
2014-05-17 02:26:51 +0800
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
refator func
1 parent
f4e7d63e
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
10 deletions
orm/models_boot.go
orm/models_boot.go
View file @
be30fb7
...
...
@@ -16,7 +16,7 @@ import (
// register models.
// prefix means table name prefix.
func
registerModel
(
model
interface
{},
prefix
string
)
{
func
registerModel
(
prefix
string
,
model
interface
{}
)
{
val
:=
reflect
.
ValueOf
(
model
)
ind
:=
reflect
.
Indirect
(
val
)
typ
:=
ind
.
Type
()
...
...
@@ -292,23 +292,17 @@ end:
// register models
func
RegisterModel
(
models
...
interface
{})
{
if
modelCache
.
done
{
panic
(
fmt
.
Errorf
(
"RegisterModel must be run before BootStrap"
))
}
for
_
,
model
:=
range
models
{
registerModel
(
model
,
""
)
}
RegisterModelWithPrefix
(
""
,
models
)
}
// register model with a prefix
// register model
s
with a prefix
func
RegisterModelWithPrefix
(
prefix
string
,
models
...
interface
{})
{
if
modelCache
.
done
{
panic
(
fmt
.
Errorf
(
"RegisterModel must be run before BootStrap"
))
}
for
_
,
model
:=
range
models
{
registerModel
(
model
,
prefix
)
registerModel
(
prefix
,
model
)
}
}
...
...
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