models

package
v0.0.0-...-411a92d Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 11, 2019 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddArticle

func AddArticle(data map[string]interface{}) error

func AddArticleTrans

func AddArticleTrans(tx *gorm.DB, data map[string]interface{}) error

func AddBrand

func AddBrand(brand *Brand) error

func AddClasslesson

func AddClasslesson(classLesson *Classlesson) error

func AddClasslessonTrans

func AddClasslessonTrans(tx *gorm.DB, classLesson *Classlesson) error

func AddCourse

func AddCourse(course *Course) error

func AddCourseTrans

func AddCourseTrans(tx *gorm.DB, course *Course) error

func AddLesson

func AddLesson(lesson *Lesson) error

func AddLessonSection

func AddLessonSection(lessonSection *Lessonsection) error

func AddLessonSectionTrans

func AddLessonSectionTrans(tx *gorm.DB, lessonSection *Lessonsection) error

func AddLessonTrans

func AddLessonTrans(tx *gorm.DB, lesson *Lesson) error

func AddOrUpdateClasslesson

func AddOrUpdateClasslesson(classLesson *Classlesson) error

func AddOrUpdateCourse

func AddOrUpdateCourse(course *Course) error

id为0时新增,否则更新

func AddOrUpdateLesson

func AddOrUpdateLesson(lesson *Lesson) error

func AddOrUpdateLessonSection

func AddOrUpdateLessonSection(lessonSection *Lessonsection) error

func AddOrUpdateStudent

func AddOrUpdateStudent(model *Student) error

id为0时新增,否则更新

func AddStudent

func AddStudent(model *Student) error

func AddStudentTrans

func AddStudentTrans(tx *gorm.DB, model *Student) error

func AddTag

func AddTag(name string, state int, createdBy string) error

func AddTagTrans

func AddTagTrans(tx *gorm.DB, name string, state int, createdBy string) error

func CheckAuth

func CheckAuth(username, password string) (bool, error)

func CleanAllArticle

func CleanAllArticle() error

func CleanAllTag

func CleanAllTag() (bool, error)

func CloseDB

func CloseDB()

func DeleteArticle

func DeleteArticle(id int) error

func DeleteBrand

func DeleteBrand(brand *Brand) error

func DeleteClasslesson

func DeleteClasslesson(id int64) error

func DeleteCourse

func DeleteCourse(id int64) error

func DeleteLesson

func DeleteLesson(id int64) error

func DeleteLessonSection

func DeleteLessonSection(id int64) error

func DeleteStudent

func DeleteStudent(id int64) error

func DeleteTag

func DeleteTag(id int) error

func EditArticle

func EditArticle(id int, data interface{}) error

func EditTag

func EditTag(id int, data interface{}) error

func ExistArticleByID

func ExistArticleByID(id int) (bool, error)

func ExistClasslessonByID

func ExistClasslessonByID(id int64) (bool, error)

func ExistCourseByID

func ExistCourseByID(id int64) (bool, error)

func ExistLessonByID

func ExistLessonByID(id int64) (bool, error)

func ExistLessonSectionByID

func ExistLessonSectionByID(id int64) (bool, error)

func ExistStudentByID

func ExistStudentByID(id int64) (bool, error)

func ExistTagByID

func ExistTagByID(id int) (bool, error)

func ExistTagByName

func ExistTagByName(name string) (bool, error)

func GetArticleTotal

func GetArticleTotal(maps interface{}) (int, error)

func GetClasslessonTotal

func GetClasslessonTotal(maps interface{}) (int, error)

func GetCourseTotal

func GetCourseTotal(maps interface{}) (int, error)

func GetLessonSectionTotal

func GetLessonSectionTotal(maps interface{}) (int, error)

func GetLessonTotal

func GetLessonTotal(maps interface{}) (int, error)

func GetStudentTotal

func GetStudentTotal(maps interface{}) (int, error)

func GetTagTotal

func GetTagTotal(maps interface{}) (int, error)

func Setup

func Setup()

func WriteDB

func WriteDB() *gorm.DB

获取写库

Types

type Article

type Article struct {
	Model

	TagID         int    `gorm:"column:tag_id"`
	Title         string `gorm:"column:title"`
	Tag           Tag
	Desc          string `gorm:"column:desc"`
	Content       string `gorm:"column:content"`
	CoverImageURL string `gorm:"column:cover_image_url"`
	CreatedBy     string `gorm:"column:created_by"`
	ModifiedBy    string `gorm:"column:modified_by"`
	State         int    `gorm:"column:state"`
}

Article 文章

func GetArticle

func GetArticle(id int) (*Article, error)

type Articles

type Articles []Article

func GetArticles

func GetArticles(pageNum int, pageSize int, maps interface{}) (Articles, error)

func (Articles) Len

func (model Articles) Len() int

func (Articles) Less

func (model Articles) Less(i, j int) bool

func (Articles) Swap

func (model Articles) Swap(i, j int)

type Auth

type Auth struct {
	ID       int    `gorm:"primary_key" json:"id"`
	Username string `json:"username"`
	Password string `json:"password"`
}

type Brand

type Brand struct {
	ID      int64     `gorm:"primary_key;column:id" json:"id"`
	Name    string    `gorm:"column:name" json:"name"`
	AddTime time.Time `gorm:"column:addTime" json:"addTime"`
}

func GetBrandList

func GetBrandList() ([]Brand, error)

type Classlesson

type Classlesson struct {
	ID int64 `gorm:"primary_key;column:id"`
	//关联查询,以ForeignKey作为外键 从Course表中以AssociationForeignKey 为references进行查询
	Course    Course    `gorm:"ForeignKey:courseId;AssociationForeignKey:courseId"`
	CourseID  int64     `gorm:"column:courseId"`
	Lesson    Lesson    `gorm:"ForeignKey:lessonId;AssociationForeignKey:lessonId"`
	LessonID  int64     `gorm:"column:lessonId"`
	PhaseID   int64     `gorm:"column:phaseId"`
	StartTime time.Time `gorm:"column:startTime"`
}

func GetClasslesson

func GetClasslesson(id int64) (*Classlesson, error)

func GetClasslessons

func GetClasslessons(pageNum int, pageSize int, maps interface{}) ([]Classlesson, error)

func GetClasslessonsByPhase

func GetClasslessonsByPhase(phaseID int64) ([]Classlesson, error)

获取phaseId的班级信息

type Course

type Course struct {
	CourseID   int64  `gorm:"primary_key;column:courseId"`
	CourseName string `gorm:"column:courseName"`
	//一对多,指定的是多的一方的外键以及对于一的一方的reference
	Lessons            []Lesson        `gorm:"ForeignKey:lessonId"`
	LessonSections     []Lessonsection `gorm:"ForeignKey:courseId"`
	CourseImage        string          `gorm:"column:courseImage"`
	Stage              string          `gorm:"column:stage"`
	LessonNum          int             `gorm:"column:lessonNum"`
	OriginalPrice      float64         `gorm:"column:originalPrice"`
	Price              float64         `gorm:"column:price"`
	LimitNum           int             `gorm:"column:limitNum"`
	BuyNum             int             `gorm:"column:buyNum"`
	MallProductID      int             `gorm:"column:mallProductId"`
	Status             int8            `gorm:"column:status"`
	TeacherID          int64           `gorm:"column:teacherId"`
	AssistantTeacherID int64           `gorm:"column:assistantTeacherId"`
	AddTime            time.Time       `gorm:"column:addTime"`
	StartTime          time.Time       `gorm:"column:startTime"`
	EndTime            time.Time       `gorm:"column:endTime"`
	CourseType         int8            `gorm:"column:courseType"`
	IsExperienceCourse int8            `gorm:"column:isExperienceCourse"`
	ListImage          string          `gorm:"column:listImage"`
	ScratchFile        string          `gorm:"column:scratchFile"`
	PrizeName          string          `gorm:"column:prizeName"`
	PrizeImage         string          `gorm:"column:prizeImage"`
	PrizeDetail        string          `gorm:"column:prizeDetail"`
	NeedBuyCourse      int8            `gorm:"column:needBuyCourse"`
	Summary            string          `gorm:"column:summary"`
	AnswerFile         string          `gorm:"column:answerFile"`
	OpenSectionID      int64           `gorm:"column:openSectionId"`
}

func GetCourse

func GetCourse(id int64) (*Course, error)

func GetCourses

func GetCourses(pageNum int, pageSize int, maps interface{}) ([]Course, error)

type Lesson

type Lesson struct {
	LessonID int64 `gorm:"primary_key;column:lessonId"`
	//关联查询,以ForeignKey作为外键 从Course表中以AssociationForeignKey 为references进行查询
	//一对一,指定的是本方的外键以及对于另一方的reference
	Course     Course    `gorm:"ForeignKey:courseId;AssociationForeignKey:courseId"`
	CourseID   int64     `gorm:"column:courseId"`
	Duration   int       `gorm:"column:duration"`
	StartTime  time.Time `gorm:"column:startTime"`
	AddTime    time.Time `gorm:"column:addTime"`
	LessonNum  int       `gorm:"column:lessonNum"`
	Brief      string    `gorm:"column:brief"`
	LessonName string    `gorm:"column:lessonName"`
}

func GetLesson

func GetLesson(id int64) (*Lesson, error)

func GetLessons

func GetLessons(pageNum int, pageSize int, maps interface{}) ([]Lesson, error)

type Lessonsection

type Lessonsection struct {
	SectionID int64  `gorm:"primary_key;column:sectionId"`
	LessonID  int64  `gorm:"column:lessonId"`
	Lesson    Lesson `gorm:"ForeignKey:lessonId"`
	//关联查询,以ForeignKey作为外键 从Course表中以AssociationForeignKey 为references进行查询
	Course             Course    `gorm:"ForeignKey:courseId"`
	CourseID           int64     `gorm:"column:courseId"`
	SectionNum         int       `gorm:"column:sectionNum"`
	Brief              string    `gorm:"column:brief"`
	SectionName        string    `gorm:"column:sectionName"`
	VideoURL           string    `gorm:"column:videoUrl"`
	VideoTimes         int       `gorm:"column:videoTimes"`
	Courseware         string    `gorm:"column:courseware"`
	ParentID           int64     `gorm:"column:parentId"`
	AddTime            time.Time `gorm:"column:addTime"`
	AnswerFile         string    `gorm:"column:answerFile"`
	WorksCover         string    `gorm:"column:worksCover"`
	CircleShareTitle   string    `gorm:"column:circleShareTitle"`
	CircleShareContent string    `gorm:"column:circleShareContent"`
	FriendShareTitle   string    `gorm:"column:friendShareTitle"`
	FriendShareContent string    `gorm:"column:friendShareContent"`
	IsChallenge        int8      `gorm:"column:isChallenge"`
	IsClockIn          int8      `gorm:"column:isClockIn"`
	SectionImage       string    `gorm:"column:sectionImage"`
}

func GetLessonSection

func GetLessonSection(id int64) (*Lessonsection, error)

func GetLessonSections

func GetLessonSections(pageNum int, pageSize int, maps interface{}) ([]Lessonsection, error)

type Model

type Model struct {
	ID         int `gorm:"primary_key" json:"id"`
	CreatedOn  int `json:"created_on"`
	ModifiedOn int `json:"modified_on"`
	DeletedOn  int `json:"deleted_on"`
}

type Student

type Student struct {
	StudentID             int64     `gorm:"primary_key;column:studentId"`
	Mobile                string    `gorm:"column:mobile"`
	HealthPoint           int       `gorm:"column:healthPoint"`
	MaxHealthPoint        int       `gorm:"column:maxHealthPoint"`
	LifeCount             int       `gorm:"column:lifeCount"`
	HealthPointUpdateTime time.Time `gorm:"column:healthPointUpdateTime"`
	AddTime               time.Time `gorm:"column:addTime"`
	LifeCountUpdateTime   time.Time `gorm:"column:lifeCountUpdateTime"`
	UserId                int64     `gorm:"column:userId"`
	UserName              string    `gorm:"column:userName"`
	Channel               string    `gorm:"column:channel"`
	Platform              string    `gorm:"column:platform"`
	SystemInfo            string    `gorm:"column:systemInfo"`
	Version               int       `gorm:"column:version"`
	LearningCard          int       `gorm:"column:learningCard"`
	LastOpenTime          time.Time `gorm:"column:lastOpenTime"`
	Coin                  int       `gorm:"column:coin"`
	AbilityValue          int       `gorm:"column:abilityValue"`
	AbilityLevel          int       `gorm:"column:abilityLevel"`
	HeadPhoto             string    `gorm:"column:headPhoto"`
	Sex                   int       `gorm:"column:sex"`
	IsEdit                int       `gorm:"column:isEdit"`
	ThroughCount          int       `gorm:"column:throughCount"`
	ThroughTimes          int       `gorm:"column:throughTimes"`
	TotalCodeRows         int       `gorm:"column:totalCodeRows"`
	TotalCodeTime         int       `gorm:"column:totalCodeTime"`
	GuideProgress         string    `gorm:"column:guideProgress"`
	LinkMobile            string    `gorm:"column:linkMobile"`
	Age                   int       `gorm:"column:age"`
	Source                string    `gorm:"column:source"`
}

func GetStudent

func GetStudent(id int64) (*Student, error)

func GetStudents

func GetStudents(pageNum int, pageSize int, maps interface{}) ([]Student, error)

type Tag

type Tag struct {
	Model
	Articles   []Article
	Name       string `gorm:"column:name"`
	CreatedBy  string `gorm:"column:created_by"`
	ModifiedBy string `gorm:"column:modified_by"`
	State      int    `gorm:"column:state"`
}

func GetTags

func GetTags(pageNum int, pageSize int, maps interface{}) ([]Tag, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL