Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
B
beego
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
go
beego
Commits
618cbf1e
Commit
618cbf1e
authored
Aug 16, 2013
by
slene
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
orm string type default will use varchar(255)
parent
c81bbf98
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
7 additions
and
7 deletions
+7
-7
models_info_f.go
orm/models_info_f.go
+3
-3
models_test.go
orm/models_test.go
+3
-3
models_utils.go
orm/models_utils.go
+1
-1
No files found.
orm/models_info_f.go
View file @
618cbf1e
...
...
@@ -206,8 +206,8 @@ checkType:
if
err
!=
nil
{
goto
end
}
if
fieldType
==
Type
TextField
&&
size
!=
"
"
{
fieldType
=
Type
Char
Field
if
fieldType
==
Type
CharField
&&
tags
[
"type"
]
==
"text
"
{
fieldType
=
Type
Text
Field
}
if
fieldType
==
TypeFloatField
&&
(
digits
!=
""
||
decimals
!=
""
)
{
fieldType
=
TypeDecimalField
...
...
@@ -312,7 +312,7 @@ checkType:
fi
.
size
=
int
(
v
)
}
}
else
{
err
=
fmt
.
Errorf
(
"size must be specify"
)
fi
.
size
=
255
}
case
TypeTextField
:
fi
.
index
=
false
...
...
orm/models_test.go
View file @
618cbf1e
...
...
@@ -15,7 +15,7 @@ import (
type
Data
struct
{
Id
int
Boolean
bool
Char
string
`orm:
size(50)
`
Char
string
`orm:
"size(50)"
`
Text
string
`orm:"type(text)"`
Date
time
.
Time
`orm:"type(date)"`
DateTime
time
.
Time
...
...
@@ -100,7 +100,7 @@ type Post struct {
Id
int
User
*
User
`orm:"rel(fk)"`
Title
string
`orm:"size(60)"`
Content
string
``
Content
string
`
orm:"type(text)"
`
Created
time
.
Time
`orm:"auto_now_add"`
Updated
time
.
Time
`orm:"auto_now"`
Tags
[]
*
Tag
`orm:"rel(m2m)"`
...
...
@@ -125,7 +125,7 @@ func NewTag() *Tag {
type
Comment
struct
{
Id
int
Post
*
Post
`orm:"rel(fk)"`
Content
string
``
Content
string
`
orm:"type(text)"
`
Parent
*
Comment
`orm:"null;rel(fk)"`
Created
time
.
Time
`orm:"auto_now_add"`
}
...
...
orm/models_utils.go
View file @
618cbf1e
...
...
@@ -64,7 +64,7 @@ func getFieldType(val reflect.Value) (ft int, err error) {
case
reflect
.
Bool
:
ft
=
TypeBooleanField
case
reflect
.
String
:
ft
=
Type
Text
Field
ft
=
Type
Char
Field
case
reflect
.
Invalid
:
default
:
if
elm
.
CanInterface
()
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
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 comment