models

package
v0.0.0-...-de8ad38 Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2021 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ModelArrayToProto

func ModelArrayToProto(models []Course) []*pb.Course

func ModelToProto

func ModelToProto(model Course) *pb.Course

func OpenDbConnection

func OpenDbConnection() (*gorm.DB, error)

func UserArrayToInt

func UserArrayToInt(users []User) []uint64

func UserToInt

func UserToInt(user User) uint64

Types

type Course

type Course struct {
	Id uint64 `json:"id,omitempty" gorm:"primaryKey;autoIncrement"`

	Name string `json:"name,omitempty"`

	Description string `json:"description,omitempty"`

	Teacher uint64 `json:"teacher,omitempty"`

	Students []User `json:"students,omitempty" gorm:"many2many:course_students;" `
}

func ProtoArrayToModel

func ProtoArrayToModel(protos []*pb.Course) []Course

func ProtoToModel

func ProtoToModel(proto *pb.Course) Course

type User

type User struct {
	ID uint64 `json:"id,omitempty" gorm:"primaryKey;autoIncrement"`
}

func IntArrayToUser

func IntArrayToUser(ids []uint64) []User

func IntToUser

func IntToUser(id uint64) User

Jump to

Keyboard shortcuts

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