Browse Source

Updated.

develop
Mingcai SHEN 8 years ago
parent
commit
8c542ef2a0
11 changed files with 403 additions and 25 deletions
  1. +0
    -1
      dao/types.go
  2. +103
    -16
      models/metas/album.go
  3. +42
    -6
      models/metas/category.go
  4. +1
    -0
      models/metas/live.go
  5. +13
    -0
      models/metas/media.go
  6. +23
    -2
      models/metas/provider.go
  7. +143
    -0
      models/stage/layouts.go
  8. +2
    -0
      models/stage/types.go
  9. +44
    -0
      xql/dao.go
  10. +0
    -0
      xql/drivers/postgres.go
  11. +32
    -0
      xql/types.go

+ 0
- 1
dao/types.go View File

@ -1 +0,0 @@
package dao

+ 103
- 16
models/metas/album.go View File

@ -1,5 +1,8 @@
package metas
import (
"time"
)
/*
class Album(DeclarativeDeneb):
@ -29,8 +32,29 @@ class Album(DeclarativeDeneb):
updated = Column(DateTime, nullable=False, default=func.NOW())
# }
provider = relation('Provider', uselist=False)
*/
type Album struct {
Id string `json:"id"`
AlbumName string `json:"albumName"`
Index int `json:"index"`
IsSeries bool `json:"isSeries"`
FilmTotal int `json:"filmTotal"`
FilmCount int `json:"filmCount"`
Remark string `json:"remark"`
IssueDate *time.Time `json:"issueDate"`
PublishTime *time.Time `json:"publishTime"`
Score float32 `json:"score"`
ContentRating string `json:"contentRating"`
AlbumPicture string `json:"albumPicture"`
ProviderId string `json:"providerId"`
ImdbId string `json:"imdbId"`
CpRefId string `json:"cpRefId"`
Description string `json:"description"`
Status int16 `json:"status"`
Created *time.Time `json:"created"`
Updated *time.Time `json:"Updated"`
}
/*
class Film(DeclarativeDeneb):
__tablename__ = 'metas_films'
# {
@ -48,8 +72,23 @@ class Film(DeclarativeDeneb):
created = Column(DateTime, nullable=False, default=func.NOW())
updated = Column(DateTime, nullable=False, default=func.NOW())
# }
*/
type Film struct {
Id string `json:"id"`
FilmName string `json:"filmName"`
Remark string `json:"remark"`
FilmPicture string `json:"filmPicture"`
Language string `json:"language"`
Duration int `json:"duration"`
IssueDate *time.Time `json:"issueDate"`
PublishTime *time.Time `json:"publishTime"`
CpRefId string `json:"cpRefId"`
Description string `json:"description"`
Status int16 `json:"status"`
Created *time.Time `json:"created"`
Updated *time.Time `json:"Updated"`
}
/*
class AlbumFilm(DeclarativeDeneb):
__tablename__ = 'metas_album_films'
# {
@ -66,8 +105,15 @@ class AlbumFilm(DeclarativeDeneb):
# }
album = relation('Album', uselist=False, backref=backref("films"))
film = relation('Film', uselist=False)
*/
type AlbumFilm struct {
AlbumId string `json:"albumId"`
FilmId string `json:"filmId"`
Index int `json:"index"`
Created *time.Time `json:"created"`
Updated *time.Time `json:"Updated"`
}
/*
class AlbumTag(DeclarativeDeneb):
__tablename__ = "metas_album_tags"
# {
@ -78,8 +124,13 @@ class AlbumTag(DeclarativeDeneb):
tag = Column(Unicode(32), nullable=False, default=u"")
# }
album = relation('Album', uselist=False, backref=backref("tags"))
*/
type AlbumTag struct {
Id string `json:"id"`
AlbumId string `json:"albumId"`
Tag string `json:"tag"`
}
/*
class AlbumGenius(DeclarativeDeneb):
__tablename__ = "metas_album_geniuses"
# {
@ -90,8 +141,13 @@ class AlbumGenius(DeclarativeDeneb):
genius = Column(Unicode(32), nullable=False, default=u"")
# }
album = relation('Album', uselist=False, backref=backref("geniuses"))
*/
type AlbumGenius struct {
Id string `json:"id"`
AlbumId string `json:"albumId"`
Genius string `json:"genius"`
}
/*
class Crew(DeclarativeDeneb):
__tablename__ = "metas_crews"
# {
@ -106,8 +162,20 @@ class Crew(DeclarativeDeneb):
created = Column(DateTime, nullable=False, default=func.NOW())
updated = Column(DateTime, nullable=False, default=func.NOW())
# }
*/
type Crew struct {
Id string `json:"id"`
FullName string `json:"fullName"`
FirstName string `json:"firstName"`
MiddleName string `json:"middleName"`
LastName string `json:"lastName"`
Region string `json:"region"`
ImdbId string `json:"imdbId"`
Description string `json:"description"`
Created *time.Time `json:"created"`
Updated *time.Time `json:"Updated"`
}
/*
class AlbumCrew(DeclarativeDeneb):
__tablename__ = "metas_album_crews"
# {
@ -122,8 +190,14 @@ class AlbumCrew(DeclarativeDeneb):
# }
crew = relation('Crew', uselist=False)
album = relation('Album', uselist=False, backref=backref("crews"))
*/
type AlbumCrew struct {
Id string `json:"id"`
AlbumId string `json:"albumId"`
CrewId string `json:"crewId"`
Role string `json:"role"`
}
/*
class FilmCrew(DeclarativeDeneb):
__tablename__ = "metas_film_crews"
# {
@ -138,8 +212,14 @@ class FilmCrew(DeclarativeDeneb):
# }
crew = relation('Crew', uselist=False)
film = relation('Film', uselist=False, backref=backref("crews"))
*/
type FilmCrew struct {
Id string `json:"id"`
FilmId string `json:"filmId"`
CrewId string `json:"crewId"`
Role string `json:"role"`
}
/*
class ScreenShot(DeclarativeDeneb):
__tablename__ = "metas_film_screenshots"
# {
@ -153,3 +233,10 @@ class ScreenShot(DeclarativeDeneb):
# }
film = relation('Film', uselist=False, backref=backref("screenShots"))
*/
type ScreenShot struct {
Id string `json:"id"`
FilmId string `json:"filmId"`
Uri string `json:"uri"`
Created *time.Time `json:"created"`
Updated *time.Time `json:"Updated"`
}

+ 42
- 6
models/metas/category.go View File

@ -1,5 +1,8 @@
package metas
import (
"time"
)
/*
class Category(DeclarativeDeneb):
@ -16,8 +19,19 @@ class Category(DeclarativeDeneb):
updated = Column(DateTime, nullable=False, default=func.NOW())
# }
filters = relationship('CategoryFilter', uselist=True, order_by="CategoryFilter.index", backref=backref("category"))
*/
type Category struct {
Id string `json:"id"`
CategoryName string `json:"categoryName"`
Type int `json:"type"`
Index int `json:"index"`
Icon string `json:"icon"`
Description string `json:"description"`
Status int16 `json:"status"`
Created *time.Time `json:"created"`
Updated *time.Time `json:"Updated"`
}
/*
class CategoryFilter(DeclarativeDeneb):
__tablename__ = 'metas_category_filters'
# {
@ -33,8 +47,16 @@ class CategoryFilter(DeclarativeDeneb):
uselist=True,
order_by="CategoryFilterTag.index",
backref=backref("filter"))
*/
type CategoryFilter struct {
Id string `json:"id"`
FilterName string `json:"filterName"`
CategoryId string `json:"categoryId"`
Expression string `json:"expression"`
Index int `json:"index"`
Status int16 `json:"index"`
}
/*
class CategoryFilterTag(DeclarativeDeneb):
__tablename__ = 'metas_category_filter_tags'
# {
@ -46,8 +68,16 @@ class CategoryFilterTag(DeclarativeDeneb):
value = Column(Unicode(32), nullable=False, default=u"")
remark = Column(Unicode(128), nullable=False, default=u"")
# }
*/
type CategoryFilterTag struct {
Id string `json:"id"`
TagName string `json:"tagName"`
FilterId string `json:"filterId"`
Index int `json:"index"`
Value string `json:"value"`
Remark string `json:"remark"`
}
/*
class CategoryAlbum(DeclarativeDeneb):
__tablename__ = 'metas_category_albums'
# {
@ -64,3 +94,9 @@ class CategoryAlbum(DeclarativeDeneb):
category = relationship('Category', uselist=False, backref=backref("albums"))
album = relationship('Album', uselist=False, backref=backref("category_list"))
*/
type CategoryAlbum struct {
CategoryId string `json:"categoryId"`
AlbumId string `json:"albumId"`
Index int `json:"index"`
Status int16 `json:"status"`
}

+ 1
- 0
models/metas/live.go View File

@ -0,0 +1 @@
package metas

+ 13
- 0
models/metas/media.go View File

@ -1,5 +1,8 @@
package metas
import (
"time"
)
/*
class Video(DeclarativeDeneb):
@ -18,3 +21,13 @@ class Video(DeclarativeDeneb):
# }
film = relation('Film', uselist=False, backref=backref("videos"))
*/
type Video struct {
Id string `json:"id"`
Definition string `json:"definition"`
Uri string `json:"uri"`
Duration int `json:"duration"`
FilmId string `json:"filmId"`
MediaType string `json:"mediaType"`
Created *time.Time `json:"created"`
Updated *time.Time `json:"Updated"`
}

+ 23
- 2
models/metas/provider.go View File

@ -1,5 +1,8 @@
package metas
import (
"time"
)
/*
class Provider(DeclarativeDeneb):
@ -14,8 +17,18 @@ class Provider(DeclarativeDeneb):
created = Column(DateTime, nullable=False, default=func.NOW())
updated = Column(DateTime, nullable=False, default=func.NOW())
# }
*/
type Provider struct {
Id string `json:"id"`
FullName string `json:"fullName"`
ShortName string `json:"shortName"`
Description string `json:"description"`
AppName string `json:"appName"`
AppKey string `json:"appKey"`
Created *time.Time `json:"created"`
Updated *time.Time `json:"Updated"`
}
/*
class ProviderCategory(DeclarativeDeneb):
__tablename__ = 'metas_provider_categories'
# {
@ -30,3 +43,11 @@ class ProviderCategory(DeclarativeDeneb):
# }
*/
type ProviderCategory struct {
ProviderId string `json:"providerId"`
CategoryId string `json:"categoryId"`
RefId string `json:"refId"`
Allowed string `json:"allowed"`
Created *time.Time `json:"created"`
Updated *time.Time `json:"Updated"`
}

+ 143
- 0
models/stage/layouts.go View File

@ -1 +1,144 @@
package stage
/*
class LayoutScreen(DeclarativeDeneb):
__tablename__ = "stage_layout_screens"
# { Columns
id = Column(UUID, primary_key=True, default=func.uuid_generate_v4())
groupName = Column('group_name', String(16), nullable=False, default="17-1D")
# fitScreen = Column('fit_screen', String(64), nullable=False, default="*")
width = Column('width', Integer, nullable=False, default=1280)
height = Column('height', Integer, nullable=False, default=720)
created = Column(DateTime, nullable=False, default=func.NOW())
updated = Column(DateTime, nullable=False, default=func.NOW())
# }
frames = relationship('LayoutFrame', uselist=True, backref=backref("screen"))
*/
type LayoutScreen struct {
}
/*
class LayoutFrame(DeclarativeDeneb):
__tablename__ = "stage_layout_frames"
# { Columns
id = Column(UUID, primary_key=True, default=func.uuid_generate_v4())
index = Column('idx', SmallInteger, nullable=False, default=1)
title = Column(Unicode(32), nullable=False, default=u"")
icon = Column(String(256), nullable=False, default="")
padding = Column(SmallInteger, nullable=False, default=1)
cellWidth = Column('cell_width', SmallInteger, nullable=False, default=190)
cellHeight = Column('cell_height', SmallInteger, nullable=False, default=160)
bgImage = Column('bg_image', String(256), nullable=False, default="")
screenId = Column('screen_id', UUID,
ForeignKey(LayoutScreen.__tablename__ + '.id', onupdate="CASCADE", ondelete="CASCADE"),
nullable=False)
created = Column(DateTime, nullable=False, default=func.NOW())
updated = Column(DateTime, nullable=False, default=func.NOW())
# }
rows = relationship('LayoutRow',
uselist=True,
backref=backref("frame"))
*/
type LayoutFrame struct {
}
/*
class LayoutRow(DeclarativeDeneb):
__tablename__ = "stage_layout_rows"
# { Columns
id = Column(UUID, primary_key=True, default=func.uuid_generate_v4())
index = Column('idx', SmallInteger, nullable=False, default=1)
width = Column(SmallInteger, nullable=False, default=0)
height = Column(SmallInteger, nullable=False, default=160)
frameId = Column('frame_id', UUID,
ForeignKey(LayoutFrame.__tablename__ + '.id', onupdate="CASCADE", ondelete="CASCADE"),
nullable=False)
created = Column(DateTime, nullable=False, default=func.NOW())
updated = Column(DateTime, nullable=False, default=func.NOW())
# }
cells = relationship('LayoutCell',
uselist=True,
backref=backref("row"))
*/
type LayoutRow struct {
}
/*
class LayoutCell(DeclarativeDeneb):
__tablename__ = "stage_layout_cells"
# { Columns
id = Column(UUID, primary_key=True, default=func.uuid_generate_v4())
index = Column('idx', SmallInteger, nullable=False, default=1)
image = Column(String(256), nullable=False, default="")
action = Column(String(256), nullable=False, default="")
title = Column(Unicode(32), nullable=False, default=u"")
textSize = Column('text_size', SmallInteger, nullable=False, default=15)
textColor = Column('text_color', String(16), nullable=False, default="#FFFFFF")
backgroundColor = Column('bg_color', String(16), nullable=False, default="#000000")
colSpan = Column('col_span', SmallInteger, nullable=False, default=1)
rowSpan = Column('row_span', SmallInteger, nullable=False, default=1)
rowId = Column('row_id', UUID,
ForeignKey(LayoutRow.__tablename__ + '.id', onupdate="CASCADE", ondelete="CASCADE"),
nullable=False)
created = Column(DateTime, nullable=False, default=func.NOW())
updated = Column(DateTime, nullable=False, default=func.NOW())
# }
*/
type LayoutCell struct {
}
/*
class Splash(DeclarativeDeneb):
__tablename__ = "stage_layout_splashes"
# { Columns
id = Column(UUID, primary_key=True, default=func.uuid_generate_v4())
groupName = Column('group_name', String(16), nullable=False, default="17-1D")
# fitScreen = Column('fit_screen', String(64), nullable=False, default="*")
description = Column(Unicode(256), nullable=True)
created = Column(DateTime, nullable=False, default=func.NOW())
updated = Column(DateTime, nullable=False, default=func.NOW())
# }
media = relationship('SplashMedia', uselist=False, backref=backref("splash"))
*/
type Splash struct {
}
/*
class SplashMedia(DeclarativeDeneb):
__tablename__ = "stage_layout_splash_medias"
# { Columns
id = Column(UUID, primary_key=True, default=func.uuid_generate_v4())
mode = Column(String(24), nullable=False, default="")
loops = Column(SmallInteger, nullable=False, default=1)
splashId = Column('splash_id', UUID,
ForeignKey(Splash.__tablename__ + '.id', onupdate="CASCADE", ondelete="CASCADE"),
nullable=False)
created = Column(DateTime, nullable=False, default=func.NOW())
updated = Column(DateTime, nullable=False, default=func.NOW())
# }
images = relationship('SplashImage', uselist=True, backref=backref("media"))
*/
type SplashMedia struct {
}
/*
class SplashImage(DeclarativeDeneb):
__tablename__ = "stage_layout_splash_images"
# { Columns
id = Column(UUID, primary_key=True, default=func.uuid_generate_v4())
index = Column('idx', SmallInteger, nullable=False, default=1)
source = Column(String(256), nullable=False, default="")
mode = Column(String(24), nullable=False, default="center")
text = Column(UnicodeText, nullable=True)
duration = Column(SmallInteger, nullable=False, default=1)
mediaId = Column('media_id', UUID,
ForeignKey(SplashMedia.__tablename__ + '.id', onupdate="CASCADE", ondelete="CASCADE"),
nullable=False)
created = Column(DateTime, nullable=False, default=func.NOW())
updated = Column(DateTime, nullable=False, default=func.NOW())
# }
*/
type SplashImage struct {
}

+ 2
- 0
models/stage/types.go View File

@ -1 +1,3 @@
package stage

+ 44
- 0
xql/dao.go View File

@ -0,0 +1,44 @@
package xql
type TableObject struct {
TableName string
Schema string
Entity interface{}
}
type QueryObject struct {
table *TableObject
}
func DeclareTable(name string, entity interface{}, schema ...string) TableObject {
t := TableObject{
TableName:name,
Entity: entity,
}
if len(schema) > 0 {
t.Schema = schema[0]
}
return t
}
func (t *TableObject) Select(fields...string) *QueryObject {
return nil
}
func (t *TableObject) Update() *QueryObject {
return nil
}
func (t *TableObject) Delete() *QueryObject {
return nil
}
func (t *TableObject) Insert() *QueryObject {
return nil
}
func (t *TableObject) Replace() *QueryObject {
return nil
}

dao/drivers/postgres.go → xql/drivers/postgres.go View File


+ 32
- 0
xql/types.go View File

@ -0,0 +1,32 @@
package xql
type ConditionType uint
const (
CONDITION_AND ConditionType = iota
CONDITION_OR
)
type OrderType uint
const (
ORDERTYPE_ASC OrderType = iota
ORDERTYPE_DESC
)
type QueryFilter struct {
Condition ConditionType // AND , OR
Reversed bool // Reversed Field and Value if it is true
Field string
Operator string // Value will not used if empty.
Value interface{}
}
type QueryOrder struct {
Type OrderType
Field string
}

Loading…
Cancel
Save