model

package
v0.0.0-...-4f40287 Latest Latest
Warning

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

Go to latest
Published: Jul 31, 2017 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// BaseID is the ID field name
	BaseID = "ID"
	// BaseIDColumnName is the ID field associated column name
	BaseIDColumnName = "id"
	// BaseCreatedAt is the CreatedAt field name
	BaseCreatedAt = "CreatedAt"
	// BaseCreatedAtColumnName is the CreatedAt field associated column name
	BaseCreatedAtColumnName = "created_at"
	// BaseUpdatedAt is the UpdatedAt field name
	BaseUpdatedAt = "UpdatedAt"
	// BaseUpdatedAtColumnName is the UpdatedAt field associated column name
	BaseUpdatedAtColumnName = "updated_at"
)
View Source
const (
	// GroupName is the Name field name
	GroupName = "Name"
	// GroupNameColumnName is the Name field associated column name
	GroupNameColumnName = "name"
)
View Source
const (
	// UserGroupUserID is the UserID field name
	UserGroupUserID = "UserID"
	// UserGroupUserIDColumnName is the UserID field associated column name
	UserGroupUserIDColumnName = "user_id"
	// UserGroupGroupID is the GroupID field name
	UserGroupGroupID = "GroupID"
	// UserGroupGroupIDColumnName is the GroupID field associated column name
	UserGroupGroupIDColumnName = "group_id"
)
View Source
const (
	// PermissionName is the Name field name
	PermissionName = "Name"
	// PermissionNameColumnName is the Name field associated column name
	PermissionNameColumnName = "name"
)
View Source
const (
	// GroupPermissionGroupID is the GroupID field name
	GroupPermissionGroupID = "GroupID"
	// GroupPermissionGroupIDColumnName is the GroupID field associated column name
	GroupPermissionGroupIDColumnName = "group_id"
	// GroupPermissionPermissionID is the PermissionID field name
	GroupPermissionPermissionID = "PermissionID"
	// GroupPermissionPermissionIDColumnName is the PermissionID field associated column name
	GroupPermissionPermissionIDColumnName = "permission_id"
)
View Source
const (
	// LogEntryStartDate is the StartDate field name
	LogEntryStartDate = "StartDate"
	// LogEntryStartDateColumnName is the StartDate field associated column name
	LogEntryStartDateColumnName = "start_date"
	// LogEntryEndDate is the EndDate field name
	LogEntryEndDate = "EndDate"
	// LogEntryEndDateColumnName is the EndDate field associated column name
	LogEntryEndDateColumnName = "end_date"
	// LogEntryDescription is the Description field name
	LogEntryDescription = "Description"
	// LogEntryDescriptionColumnName is the Description field associated column name
	LogEntryDescriptionColumnName = "description"
)
View Source
const (
	// LogEntryParticipantEntryID is the EntryID field name
	LogEntryParticipantEntryID = "EntryID"
	// LogEntryParticipantEntryIDColumnName is the EntryID field associated column name
	LogEntryParticipantEntryIDColumnName = "entry_id"
	// LogEntryParticipantPupilID is the PupilID field name
	LogEntryParticipantPupilID = "PupilID"
	// LogEntryParticipantPupilIDColumnName is the PupilID field associated column name
	LogEntryParticipantPupilIDColumnName = "pupil_id"
)
View Source
const (
	// LogEntrySkillEntryID is the EntryID field name
	LogEntrySkillEntryID = "EntryID"
	// LogEntrySkillEntryIDColumnName is the EntryID field associated column name
	LogEntrySkillEntryIDColumnName = "entry_id"
	// LogEntrySkillSkillID is the SkillID field name
	LogEntrySkillSkillID = "SkillID"
	// LogEntrySkillSkillIDColumnName is the SkillID field associated column name
	LogEntrySkillSkillIDColumnName = "skill_id"
)
View Source
const (
	// PupilFirstName is the FirstName field name
	PupilFirstName = "FirstName"
	// PupilFirstNameColumnName is the FirstName field associated column name
	PupilFirstNameColumnName = "first_name"
	// PupilMiddleName is the MiddleName field name
	PupilMiddleName = "MiddleName"
	// PupilMiddleNameColumnName is the MiddleName field associated column name
	PupilMiddleNameColumnName = "middle_name"
	// PupilLastName is the LastName field name
	PupilLastName = "LastName"
	// PupilLastNameColumnName is the LastName field associated column name
	PupilLastNameColumnName = "last_name"
	// PupilBirthDate is the BirthDate field name
	PupilBirthDate = "BirthDate"
	// PupilBirthDateColumnName is the BirthDate field associated column name
	PupilBirthDateColumnName = "birth_date"
	// PupilIsActive is the IsActive field name
	PupilIsActive = "IsActive"
	// PupilIsActiveColumnName is the IsActive field associated column name
	PupilIsActiveColumnName = "is_active"
	// PupilFtsDirty is the FtsDirty field name
	PupilFtsDirty = "FtsDirty"
	// PupilFtsDirtyColumnName is the FtsDirty field associated column name
	PupilFtsDirtyColumnName = "fts_dirty"
)
View Source
const (
	// SkillName is the Name field name
	SkillName = "Name"
	// SkillNameColumnName is the Name field associated column name
	SkillNameColumnName = "name"
	// SkillDescription is the Description field name
	SkillDescription = "Description"
	// SkillDescriptionColumnName is the Description field associated column name
	SkillDescriptionColumnName = "description"
	// SkillIsActive is the IsActive field name
	SkillIsActive = "IsActive"
	// SkillIsActiveColumnName is the IsActive field associated column name
	SkillIsActiveColumnName = "is_active"
	// SkillFtsDirty is the FtsDirty field name
	SkillFtsDirty = "FtsDirty"
	// SkillFtsDirtyColumnName is the FtsDirty field associated column name
	SkillFtsDirtyColumnName = "fts_dirty"
)
View Source
const (
	// UserName is the Name field name
	UserName = "Name"
	// UserNameColumnName is the Name field associated column name
	UserNameColumnName = "name"
	// UserPassword is the Password field name
	UserPassword = "Password"
	// UserPasswordColumnName is the Password field associated column name
	UserPasswordColumnName = "password"
)
View Source
const (
	// GroupPermissionTableName is the GroupPermission associated table name
	GroupPermissionTableName = "group_permission"
)
View Source
const (
	// GroupTableName is the Group associated table name
	GroupTableName = "hermes_group"
)
View Source
const (
	// LogEntryParticipantTableName is the LogEntryParticipant associated table name
	LogEntryParticipantTableName = "log_entry_participant"
)
View Source
const (
	// LogEntrySkillTableName is the LogEntrySkill associated table name
	LogEntrySkillTableName = "log_entry_skill"
)
View Source
const (
	// LogEntryTableName is the LogEntry associated table name
	LogEntryTableName = "log_entry"
)
View Source
const (
	// PermissionTableName is the Permission associated table name
	PermissionTableName = "permission"
)
View Source
const (
	// PupilTableName is the Pupil associated table name
	PupilTableName = "pupil"
)
View Source
const (
	// SkillTableName is the Skill associated table name
	SkillTableName = "skill"
)
View Source
const (
	// UserGroupTableName is the UserGroup associated table name
	UserGroupTableName = "user_group"
)
View Source
const (
	// UserTableName is the User associated table name
	UserTableName = "hermes_user"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Base

type Base struct {
	ID        int64     `yago:"primary_key,auto_increment" json:"id"`
	CreatedAt time.Time `yago:"type=qb.Timestamp()" json:"created_at"`
	UpdatedAt time.Time `yago:"type=qb.Timestamp()" json:"updated_at"`
}

Base struct for our database models.

func (*Base) BeforeInsert

func (m *Base) BeforeInsert(db *yago.DB)

BeforeInsert callback

func (*Base) BeforeUpdate

func (m *Base) BeforeUpdate(db *yago.DB)

BeforeUpdate callback

type Group

type Group struct {
	Base
	Name string `yago:"not null,unique"`
}

Group defines a group of users

func (Group) StructType

func (Group) StructType() reflect.Type

StructType returns the reflect.Type of the struct It is used for indexing mappers (and only that I guess, so it could be replaced with a unique identifier).

type GroupMapper

type GroupMapper struct{}

GroupMapper is the Group mapper

func NewGroupMapper

func NewGroupMapper() *GroupMapper

NewGroupMapper initialize a NewGroupMapper

func (GroupMapper) AutoIncrementPKey

func (GroupMapper) AutoIncrementPKey() bool

AutoIncrementPKey return true if a column of the pkey is autoincremented

func (GroupMapper) FieldList

func (mapper GroupMapper) FieldList() []qb.Clause

FieldList returns the list of fields for a select

func (*GroupMapper) GetMapper

func (mapper *GroupMapper) GetMapper() yago.Mapper

GetMapper returns itself

func (GroupMapper) LoadAutoIncrementPKeyValue

func (GroupMapper) LoadAutoIncrementPKeyValue(instance yago.MappedStruct, value int64)

LoadAutoIncrementPKeyValue set the pkey autoincremented column value

func (*GroupMapper) Name

func (*GroupMapper) Name() string

Name returns the mapper name

func (GroupMapper) PKey

func (mapper GroupMapper) PKey(instance yago.MappedStruct) (values []interface{})

PKey returns the instance primary key values

func (GroupMapper) PKeyClause

func (mapper GroupMapper) PKeyClause(values []interface{}) qb.Clause

PKeyClause returns a clause that matches the instance primary key

func (GroupMapper) SQLValues

func (mapper GroupMapper) SQLValues(instance yago.MappedStruct, fields ...string) map[string]interface{}

SQLValues returns values as a map The primary key is included only if having non-default values

func (GroupMapper) Scan

func (mapper GroupMapper) Scan(rows *sql.Rows, instance yago.MappedStruct) error

Scan a struct

func (GroupMapper) ScanPKey

func (mapper GroupMapper) ScanPKey(rows *sql.Rows, instance yago.MappedStruct) error

ScanPKey scans the primary key only

func (GroupMapper) StructType

func (GroupMapper) StructType() reflect.Type

StructType returns the reflect.Type of the mapped structure

func (*GroupMapper) Table

func (*GroupMapper) Table() *qb.TableElem

Table returns the mapper table

type GroupModel

type GroupModel struct {
	Name      yago.ScalarField
	ID        yago.ScalarField
	CreatedAt yago.ScalarField
	UpdatedAt yago.ScalarField
	// contains filtered or unexported fields
}

GroupModel provides direct access to helpers for Group queries

func NewGroupModel

func NewGroupModel(meta *yago.Metadata) GroupModel

NewGroupModel returns a new GroupModel

func (GroupModel) GetMapper

func (m GroupModel) GetMapper() yago.Mapper

GetMapper returns the associated GroupMapper instance

type GroupPermission

type GroupPermission struct {
	Base
	GroupID      int64 `yago:"fk=Group ONDELETE RESTRICT"`
	PermissionID int64 `yago:"fk=Permission ONDELETE CASCADE"`
}

GroupPermission defines the relation table between a group and its persmissions

func (GroupPermission) StructType

func (GroupPermission) StructType() reflect.Type

StructType returns the reflect.Type of the struct It is used for indexing mappers (and only that I guess, so it could be replaced with a unique identifier).

type GroupPermissionMapper

type GroupPermissionMapper struct{}

GroupPermissionMapper is the GroupPermission mapper

func NewGroupPermissionMapper

func NewGroupPermissionMapper() *GroupPermissionMapper

NewGroupPermissionMapper initialize a NewGroupPermissionMapper

func (GroupPermissionMapper) AutoIncrementPKey

func (GroupPermissionMapper) AutoIncrementPKey() bool

AutoIncrementPKey return true if a column of the pkey is autoincremented

func (GroupPermissionMapper) FieldList

func (mapper GroupPermissionMapper) FieldList() []qb.Clause

FieldList returns the list of fields for a select

func (*GroupPermissionMapper) GetMapper

func (mapper *GroupPermissionMapper) GetMapper() yago.Mapper

GetMapper returns itself

func (GroupPermissionMapper) LoadAutoIncrementPKeyValue

func (GroupPermissionMapper) LoadAutoIncrementPKeyValue(instance yago.MappedStruct, value int64)

LoadAutoIncrementPKeyValue set the pkey autoincremented column value

func (*GroupPermissionMapper) Name

func (*GroupPermissionMapper) Name() string

Name returns the mapper name

func (GroupPermissionMapper) PKey

func (mapper GroupPermissionMapper) PKey(instance yago.MappedStruct) (values []interface{})

PKey returns the instance primary key values

func (GroupPermissionMapper) PKeyClause

func (mapper GroupPermissionMapper) PKeyClause(values []interface{}) qb.Clause

PKeyClause returns a clause that matches the instance primary key

func (GroupPermissionMapper) SQLValues

func (mapper GroupPermissionMapper) SQLValues(instance yago.MappedStruct, fields ...string) map[string]interface{}

SQLValues returns values as a map The primary key is included only if having non-default values

func (GroupPermissionMapper) Scan

func (mapper GroupPermissionMapper) Scan(rows *sql.Rows, instance yago.MappedStruct) error

Scan a struct

func (GroupPermissionMapper) ScanPKey

func (mapper GroupPermissionMapper) ScanPKey(rows *sql.Rows, instance yago.MappedStruct) error

ScanPKey scans the primary key only

func (GroupPermissionMapper) StructType

func (GroupPermissionMapper) StructType() reflect.Type

StructType returns the reflect.Type of the mapped structure

func (*GroupPermissionMapper) Table

Table returns the mapper table

type GroupPermissionModel

type GroupPermissionModel struct {
	GroupID      yago.ScalarField
	PermissionID yago.ScalarField
	ID           yago.ScalarField
	CreatedAt    yago.ScalarField
	UpdatedAt    yago.ScalarField
	// contains filtered or unexported fields
}

GroupPermissionModel provides direct access to helpers for GroupPermission queries

func NewGroupPermissionModel

func NewGroupPermissionModel(meta *yago.Metadata) GroupPermissionModel

NewGroupPermissionModel returns a new GroupPermissionModel

func (GroupPermissionModel) GetMapper

func (m GroupPermissionModel) GetMapper() yago.Mapper

GetMapper returns the associated GroupPermissionMapper instance

type LogEntry

type LogEntry struct {
	Base
	StartDate   time.Time `yago:"not null" json:"start_date"`
	EndDate     time.Time `yago:"not null" json:"end_date"`
	Description string    `json:"description"`
}

LogEntry is the struct we use to store data about an moment in the day. We can have many in one day. Each time the adult responsible of the group of pupils wants to log a period of time he will create a LogEntry and then add the participants and the skills that were involved

func (LogEntry) JsonKeysToFields

func (m LogEntry) JsonKeysToFields(keys []string) (res []string)

JsonKeysToFields is a helper that takes a list of json keys and returns the field names in the data structure this is used for update scenario when we want to update only certain fields TODO: use the json tags and auto fill the values...

func (LogEntry) StructType

func (LogEntry) StructType() reflect.Type

StructType returns the reflect.Type of the struct It is used for indexing mappers (and only that I guess, so it could be replaced with a unique identifier).

type LogEntryMapper

type LogEntryMapper struct{}

LogEntryMapper is the LogEntry mapper

func NewLogEntryMapper

func NewLogEntryMapper() *LogEntryMapper

NewLogEntryMapper initialize a NewLogEntryMapper

func (LogEntryMapper) AutoIncrementPKey

func (LogEntryMapper) AutoIncrementPKey() bool

AutoIncrementPKey return true if a column of the pkey is autoincremented

func (LogEntryMapper) FieldList

func (mapper LogEntryMapper) FieldList() []qb.Clause

FieldList returns the list of fields for a select

func (*LogEntryMapper) GetMapper

func (mapper *LogEntryMapper) GetMapper() yago.Mapper

GetMapper returns itself

func (LogEntryMapper) LoadAutoIncrementPKeyValue

func (LogEntryMapper) LoadAutoIncrementPKeyValue(instance yago.MappedStruct, value int64)

LoadAutoIncrementPKeyValue set the pkey autoincremented column value

func (*LogEntryMapper) Name

func (*LogEntryMapper) Name() string

Name returns the mapper name

func (LogEntryMapper) PKey

func (mapper LogEntryMapper) PKey(instance yago.MappedStruct) (values []interface{})

PKey returns the instance primary key values

func (LogEntryMapper) PKeyClause

func (mapper LogEntryMapper) PKeyClause(values []interface{}) qb.Clause

PKeyClause returns a clause that matches the instance primary key

func (LogEntryMapper) SQLValues

func (mapper LogEntryMapper) SQLValues(instance yago.MappedStruct, fields ...string) map[string]interface{}

SQLValues returns values as a map The primary key is included only if having non-default values

func (LogEntryMapper) Scan

func (mapper LogEntryMapper) Scan(rows *sql.Rows, instance yago.MappedStruct) error

Scan a struct

func (LogEntryMapper) ScanPKey

func (mapper LogEntryMapper) ScanPKey(rows *sql.Rows, instance yago.MappedStruct) error

ScanPKey scans the primary key only

func (LogEntryMapper) StructType

func (LogEntryMapper) StructType() reflect.Type

StructType returns the reflect.Type of the mapped structure

func (*LogEntryMapper) Table

func (*LogEntryMapper) Table() *qb.TableElem

Table returns the mapper table

type LogEntryModel

type LogEntryModel struct {
	StartDate   yago.ScalarField
	EndDate     yago.ScalarField
	Description yago.ScalarField
	ID          yago.ScalarField
	CreatedAt   yago.ScalarField
	UpdatedAt   yago.ScalarField
	// contains filtered or unexported fields
}

LogEntryModel provides direct access to helpers for LogEntry queries

func NewLogEntryModel

func NewLogEntryModel(meta *yago.Metadata) LogEntryModel

NewLogEntryModel returns a new LogEntryModel

func (LogEntryModel) GetMapper

func (m LogEntryModel) GetMapper() yago.Mapper

GetMapper returns the associated LogEntryMapper instance

type LogEntryParticipant

type LogEntryParticipant struct {
	Base
	EntryID int64 `yago:"fk=LogEntry ONDELETE CASCADE,unique_index=entrypupil" json:"entry_id"`
	PupilID int64 `yago:"fk=Pupil ONDELETE RESTRICT,unique_index=entrypupil" json:"pupil_id"`
}

LogEntryParticipant defines the relation table between the LogEntry and its participants

func (LogEntryParticipant) StructType

func (LogEntryParticipant) StructType() reflect.Type

StructType returns the reflect.Type of the struct It is used for indexing mappers (and only that I guess, so it could be replaced with a unique identifier).

type LogEntryParticipantMapper

type LogEntryParticipantMapper struct{}

LogEntryParticipantMapper is the LogEntryParticipant mapper

func NewLogEntryParticipantMapper

func NewLogEntryParticipantMapper() *LogEntryParticipantMapper

NewLogEntryParticipantMapper initialize a NewLogEntryParticipantMapper

func (LogEntryParticipantMapper) AutoIncrementPKey

func (LogEntryParticipantMapper) AutoIncrementPKey() bool

AutoIncrementPKey return true if a column of the pkey is autoincremented

func (LogEntryParticipantMapper) FieldList

func (mapper LogEntryParticipantMapper) FieldList() []qb.Clause

FieldList returns the list of fields for a select

func (*LogEntryParticipantMapper) GetMapper

func (mapper *LogEntryParticipantMapper) GetMapper() yago.Mapper

GetMapper returns itself

func (LogEntryParticipantMapper) LoadAutoIncrementPKeyValue

func (LogEntryParticipantMapper) LoadAutoIncrementPKeyValue(instance yago.MappedStruct, value int64)

LoadAutoIncrementPKeyValue set the pkey autoincremented column value

func (*LogEntryParticipantMapper) Name

Name returns the mapper name

func (LogEntryParticipantMapper) PKey

func (mapper LogEntryParticipantMapper) PKey(instance yago.MappedStruct) (values []interface{})

PKey returns the instance primary key values

func (LogEntryParticipantMapper) PKeyClause

func (mapper LogEntryParticipantMapper) PKeyClause(values []interface{}) qb.Clause

PKeyClause returns a clause that matches the instance primary key

func (LogEntryParticipantMapper) SQLValues

func (mapper LogEntryParticipantMapper) SQLValues(instance yago.MappedStruct, fields ...string) map[string]interface{}

SQLValues returns values as a map The primary key is included only if having non-default values

func (LogEntryParticipantMapper) Scan

func (mapper LogEntryParticipantMapper) Scan(rows *sql.Rows, instance yago.MappedStruct) error

Scan a struct

func (LogEntryParticipantMapper) ScanPKey

func (mapper LogEntryParticipantMapper) ScanPKey(rows *sql.Rows, instance yago.MappedStruct) error

ScanPKey scans the primary key only

func (LogEntryParticipantMapper) StructType

func (LogEntryParticipantMapper) StructType() reflect.Type

StructType returns the reflect.Type of the mapped structure

func (*LogEntryParticipantMapper) Table

Table returns the mapper table

type LogEntryParticipantModel

type LogEntryParticipantModel struct {
	EntryID   yago.ScalarField
	PupilID   yago.ScalarField
	ID        yago.ScalarField
	CreatedAt yago.ScalarField
	UpdatedAt yago.ScalarField
	// contains filtered or unexported fields
}

LogEntryParticipantModel provides direct access to helpers for LogEntryParticipant queries

func NewLogEntryParticipantModel

func NewLogEntryParticipantModel(meta *yago.Metadata) LogEntryParticipantModel

NewLogEntryParticipantModel returns a new LogEntryParticipantModel

func (LogEntryParticipantModel) GetMapper

func (m LogEntryParticipantModel) GetMapper() yago.Mapper

GetMapper returns the associated LogEntryParticipantMapper instance

type LogEntrySkill

type LogEntrySkill struct {
	Base
	EntryID int64 `yago:"fk=LogEntry ONDELETE CASCADE,unique_index=entryskill" json:"entry_id"`
	SkillID int64 `yago:"fk=Skill ONDELETE RESTRICT,unique_index=entryskill" json:"skill_id"`
}

LogEntrySkill defines the relation table between the LogEntry and its Skills

func (LogEntrySkill) StructType

func (LogEntrySkill) StructType() reflect.Type

StructType returns the reflect.Type of the struct It is used for indexing mappers (and only that I guess, so it could be replaced with a unique identifier).

type LogEntrySkillMapper

type LogEntrySkillMapper struct{}

LogEntrySkillMapper is the LogEntrySkill mapper

func NewLogEntrySkillMapper

func NewLogEntrySkillMapper() *LogEntrySkillMapper

NewLogEntrySkillMapper initialize a NewLogEntrySkillMapper

func (LogEntrySkillMapper) AutoIncrementPKey

func (LogEntrySkillMapper) AutoIncrementPKey() bool

AutoIncrementPKey return true if a column of the pkey is autoincremented

func (LogEntrySkillMapper) FieldList

func (mapper LogEntrySkillMapper) FieldList() []qb.Clause

FieldList returns the list of fields for a select

func (*LogEntrySkillMapper) GetMapper

func (mapper *LogEntrySkillMapper) GetMapper() yago.Mapper

GetMapper returns itself

func (LogEntrySkillMapper) LoadAutoIncrementPKeyValue

func (LogEntrySkillMapper) LoadAutoIncrementPKeyValue(instance yago.MappedStruct, value int64)

LoadAutoIncrementPKeyValue set the pkey autoincremented column value

func (*LogEntrySkillMapper) Name

func (*LogEntrySkillMapper) Name() string

Name returns the mapper name

func (LogEntrySkillMapper) PKey

func (mapper LogEntrySkillMapper) PKey(instance yago.MappedStruct) (values []interface{})

PKey returns the instance primary key values

func (LogEntrySkillMapper) PKeyClause

func (mapper LogEntrySkillMapper) PKeyClause(values []interface{}) qb.Clause

PKeyClause returns a clause that matches the instance primary key

func (LogEntrySkillMapper) SQLValues

func (mapper LogEntrySkillMapper) SQLValues(instance yago.MappedStruct, fields ...string) map[string]interface{}

SQLValues returns values as a map The primary key is included only if having non-default values

func (LogEntrySkillMapper) Scan

func (mapper LogEntrySkillMapper) Scan(rows *sql.Rows, instance yago.MappedStruct) error

Scan a struct

func (LogEntrySkillMapper) ScanPKey

func (mapper LogEntrySkillMapper) ScanPKey(rows *sql.Rows, instance yago.MappedStruct) error

ScanPKey scans the primary key only

func (LogEntrySkillMapper) StructType

func (LogEntrySkillMapper) StructType() reflect.Type

StructType returns the reflect.Type of the mapped structure

func (*LogEntrySkillMapper) Table

func (*LogEntrySkillMapper) Table() *qb.TableElem

Table returns the mapper table

type LogEntrySkillModel

type LogEntrySkillModel struct {
	EntryID   yago.ScalarField
	SkillID   yago.ScalarField
	ID        yago.ScalarField
	CreatedAt yago.ScalarField
	UpdatedAt yago.ScalarField
	// contains filtered or unexported fields
}

LogEntrySkillModel provides direct access to helpers for LogEntrySkill queries

func NewLogEntrySkillModel

func NewLogEntrySkillModel(meta *yago.Metadata) LogEntrySkillModel

NewLogEntrySkillModel returns a new LogEntrySkillModel

func (LogEntrySkillModel) GetMapper

func (m LogEntrySkillModel) GetMapper() yago.Mapper

GetMapper returns the associated LogEntrySkillMapper instance

type Model

type Model struct {
	Meta *yago.Metadata

	Skill               SkillModel
	Pupil               PupilModel
	User                UserModel
	Group               GroupModel
	Permission          PermissionModel
	UserGroup           UserGroupModel
	GroupPermission     GroupPermissionModel
	LogEntry            LogEntryModel
	LogEntryParticipant LogEntryParticipantModel
	LogEntrySkill       LogEntrySkillModel
}

Model is the yago model our application uses to access data in Db

func NewDB

func NewDB(driver string, params string) (*Model, *yago.DB, error)

NewDB initialize a Model and a DB

func NewModel

func NewModel() *Model

NewModel initialize a new Model

type NullTime

type NullTime struct {
	Time  time.Time
	Valid bool // Valid is true if Time is not NULL
}

NullTime is a nullable time type that can be null this is a copy of https://github.com/lib/pq/blob/master/encode.go#L569

func (*NullTime) Scan

func (nt *NullTime) Scan(value interface{}) error

Scan implements the Scanner interface.

func (NullTime) Value

func (nt NullTime) Value() (driver.Value, error)

Value implements the driver Valuer interface.

type Permission

type Permission struct {
	Base
	Name string `yago:"not null,unique"`
}

Permission defines permissions for users

func (Permission) StructType

func (Permission) StructType() reflect.Type

StructType returns the reflect.Type of the struct It is used for indexing mappers (and only that I guess, so it could be replaced with a unique identifier).

type PermissionMapper

type PermissionMapper struct{}

PermissionMapper is the Permission mapper

func NewPermissionMapper

func NewPermissionMapper() *PermissionMapper

NewPermissionMapper initialize a NewPermissionMapper

func (PermissionMapper) AutoIncrementPKey

func (PermissionMapper) AutoIncrementPKey() bool

AutoIncrementPKey return true if a column of the pkey is autoincremented

func (PermissionMapper) FieldList

func (mapper PermissionMapper) FieldList() []qb.Clause

FieldList returns the list of fields for a select

func (*PermissionMapper) GetMapper

func (mapper *PermissionMapper) GetMapper() yago.Mapper

GetMapper returns itself

func (PermissionMapper) LoadAutoIncrementPKeyValue

func (PermissionMapper) LoadAutoIncrementPKeyValue(instance yago.MappedStruct, value int64)

LoadAutoIncrementPKeyValue set the pkey autoincremented column value

func (*PermissionMapper) Name

func (*PermissionMapper) Name() string

Name returns the mapper name

func (PermissionMapper) PKey

func (mapper PermissionMapper) PKey(instance yago.MappedStruct) (values []interface{})

PKey returns the instance primary key values

func (PermissionMapper) PKeyClause

func (mapper PermissionMapper) PKeyClause(values []interface{}) qb.Clause

PKeyClause returns a clause that matches the instance primary key

func (PermissionMapper) SQLValues

func (mapper PermissionMapper) SQLValues(instance yago.MappedStruct, fields ...string) map[string]interface{}

SQLValues returns values as a map The primary key is included only if having non-default values

func (PermissionMapper) Scan

func (mapper PermissionMapper) Scan(rows *sql.Rows, instance yago.MappedStruct) error

Scan a struct

func (PermissionMapper) ScanPKey

func (mapper PermissionMapper) ScanPKey(rows *sql.Rows, instance yago.MappedStruct) error

ScanPKey scans the primary key only

func (PermissionMapper) StructType

func (PermissionMapper) StructType() reflect.Type

StructType returns the reflect.Type of the mapped structure

func (*PermissionMapper) Table

func (*PermissionMapper) Table() *qb.TableElem

Table returns the mapper table

type PermissionModel

type PermissionModel struct {
	Name      yago.ScalarField
	ID        yago.ScalarField
	CreatedAt yago.ScalarField
	UpdatedAt yago.ScalarField
	// contains filtered or unexported fields
}

PermissionModel provides direct access to helpers for Permission queries

func NewPermissionModel

func NewPermissionModel(meta *yago.Metadata) PermissionModel

NewPermissionModel returns a new PermissionModel

func (PermissionModel) GetMapper

func (m PermissionModel) GetMapper() yago.Mapper

GetMapper returns the associated PermissionMapper instance

type Pupil

type Pupil struct {
	Base
	FirstName  string    `yago:"not null" json:"first_name"`
	MiddleName string    `json:"middle_name"`
	LastName   string    `yago:"not null" json:"last_name"`
	BirthDate  time.Time `json:"birth_date"`
	IsActive   bool      `json:"is_active"`
	FtsDirty   bool      `json:"-"` // flag used for elastic search
}

Pupil represents the people that engage in activities and will acquire skills

func (Pupil) JsonKeysToFields

func (m Pupil) JsonKeysToFields(keys []string) (res []string)

JsonKeysToFields is a helper that takes a list of json keys and returns the field names in the data structure this is used for update scenario when we want to update only certain fields TODO: use the json tags and auto fill the values...

func (Pupil) StructType

func (Pupil) StructType() reflect.Type

StructType returns the reflect.Type of the struct It is used for indexing mappers (and only that I guess, so it could be replaced with a unique identifier).

type PupilMapper

type PupilMapper struct{}

PupilMapper is the Pupil mapper

func NewPupilMapper

func NewPupilMapper() *PupilMapper

NewPupilMapper initialize a NewPupilMapper

func (PupilMapper) AutoIncrementPKey

func (PupilMapper) AutoIncrementPKey() bool

AutoIncrementPKey return true if a column of the pkey is autoincremented

func (PupilMapper) FieldList

func (mapper PupilMapper) FieldList() []qb.Clause

FieldList returns the list of fields for a select

func (*PupilMapper) GetMapper

func (mapper *PupilMapper) GetMapper() yago.Mapper

GetMapper returns itself

func (PupilMapper) LoadAutoIncrementPKeyValue

func (PupilMapper) LoadAutoIncrementPKeyValue(instance yago.MappedStruct, value int64)

LoadAutoIncrementPKeyValue set the pkey autoincremented column value

func (*PupilMapper) Name

func (*PupilMapper) Name() string

Name returns the mapper name

func (PupilMapper) PKey

func (mapper PupilMapper) PKey(instance yago.MappedStruct) (values []interface{})

PKey returns the instance primary key values

func (PupilMapper) PKeyClause

func (mapper PupilMapper) PKeyClause(values []interface{}) qb.Clause

PKeyClause returns a clause that matches the instance primary key

func (PupilMapper) SQLValues

func (mapper PupilMapper) SQLValues(instance yago.MappedStruct, fields ...string) map[string]interface{}

SQLValues returns values as a map The primary key is included only if having non-default values

func (PupilMapper) Scan

func (mapper PupilMapper) Scan(rows *sql.Rows, instance yago.MappedStruct) error

Scan a struct

func (PupilMapper) ScanPKey

func (mapper PupilMapper) ScanPKey(rows *sql.Rows, instance yago.MappedStruct) error

ScanPKey scans the primary key only

func (PupilMapper) StructType

func (PupilMapper) StructType() reflect.Type

StructType returns the reflect.Type of the mapped structure

func (*PupilMapper) Table

func (*PupilMapper) Table() *qb.TableElem

Table returns the mapper table

type PupilModel

type PupilModel struct {
	FirstName  yago.ScalarField
	MiddleName yago.ScalarField
	LastName   yago.ScalarField
	BirthDate  yago.ScalarField
	IsActive   yago.ScalarField
	FtsDirty   yago.ScalarField
	ID         yago.ScalarField
	CreatedAt  yago.ScalarField
	UpdatedAt  yago.ScalarField
	// contains filtered or unexported fields
}

PupilModel provides direct access to helpers for Pupil queries

func NewPupilModel

func NewPupilModel(meta *yago.Metadata) PupilModel

NewPupilModel returns a new PupilModel

func (PupilModel) GetMapper

func (m PupilModel) GetMapper() yago.Mapper

GetMapper returns the associated PupilMapper instance

type Skill

type Skill struct {
	Base
	Name        string `yago:"not null,unique" json:"name"`
	Description string `json:"description"`
	IsActive    bool   `json:"is_active"`
	FtsDirty    bool   `json:"-"` // flag used for elastic search
}

Skill is the datastructure that holds the skill definitions Skills are used in activities and thus inferred for a pupil from their activities

func (Skill) JsonKeysToFields

func (m Skill) JsonKeysToFields(keys []string) (res []string)

JsonKeysToFields is a helper that takes a list of json keys and returns the field names in the data structure this is used for update scenario when we want to update only certain fields TODO: use the json tags and auto fill the values...

func (Skill) StructType

func (Skill) StructType() reflect.Type

StructType returns the reflect.Type of the struct It is used for indexing mappers (and only that I guess, so it could be replaced with a unique identifier).

type SkillMapper

type SkillMapper struct{}

SkillMapper is the Skill mapper

func NewSkillMapper

func NewSkillMapper() *SkillMapper

NewSkillMapper initialize a NewSkillMapper

func (SkillMapper) AutoIncrementPKey

func (SkillMapper) AutoIncrementPKey() bool

AutoIncrementPKey return true if a column of the pkey is autoincremented

func (SkillMapper) FieldList

func (mapper SkillMapper) FieldList() []qb.Clause

FieldList returns the list of fields for a select

func (*SkillMapper) GetMapper

func (mapper *SkillMapper) GetMapper() yago.Mapper

GetMapper returns itself

func (SkillMapper) LoadAutoIncrementPKeyValue

func (SkillMapper) LoadAutoIncrementPKeyValue(instance yago.MappedStruct, value int64)

LoadAutoIncrementPKeyValue set the pkey autoincremented column value

func (*SkillMapper) Name

func (*SkillMapper) Name() string

Name returns the mapper name

func (SkillMapper) PKey

func (mapper SkillMapper) PKey(instance yago.MappedStruct) (values []interface{})

PKey returns the instance primary key values

func (SkillMapper) PKeyClause

func (mapper SkillMapper) PKeyClause(values []interface{}) qb.Clause

PKeyClause returns a clause that matches the instance primary key

func (SkillMapper) SQLValues

func (mapper SkillMapper) SQLValues(instance yago.MappedStruct, fields ...string) map[string]interface{}

SQLValues returns values as a map The primary key is included only if having non-default values

func (SkillMapper) Scan

func (mapper SkillMapper) Scan(rows *sql.Rows, instance yago.MappedStruct) error

Scan a struct

func (SkillMapper) ScanPKey

func (mapper SkillMapper) ScanPKey(rows *sql.Rows, instance yago.MappedStruct) error

ScanPKey scans the primary key only

func (SkillMapper) StructType

func (SkillMapper) StructType() reflect.Type

StructType returns the reflect.Type of the mapped structure

func (*SkillMapper) Table

func (*SkillMapper) Table() *qb.TableElem

Table returns the mapper table

type SkillModel

type SkillModel struct {
	Name        yago.ScalarField
	Description yago.ScalarField
	IsActive    yago.ScalarField
	FtsDirty    yago.ScalarField
	ID          yago.ScalarField
	CreatedAt   yago.ScalarField
	UpdatedAt   yago.ScalarField
	// contains filtered or unexported fields
}

SkillModel provides direct access to helpers for Skill queries

func NewSkillModel

func NewSkillModel(meta *yago.Metadata) SkillModel

NewSkillModel returns a new SkillModel

func (SkillModel) GetMapper

func (m SkillModel) GetMapper() yago.Mapper

GetMapper returns the associated SkillMapper instance

type User

type User struct {
	Base
	Name     string `yago:"not null,unique"`
	Password string `yago:"not null"`
}

User defines users in the system

func (User) StructType

func (User) StructType() reflect.Type

StructType returns the reflect.Type of the struct It is used for indexing mappers (and only that I guess, so it could be replaced with a unique identifier).

type UserGroup

type UserGroup struct {
	Base
	UserID  int64 `yago:"fk=User ONDELETE CASCADE"`
	GroupID int64 `yago:"fk=Group ONDELETE RESTRICT"`
}

UserGroup defines the relation table between a user and its groups

func (UserGroup) StructType

func (UserGroup) StructType() reflect.Type

StructType returns the reflect.Type of the struct It is used for indexing mappers (and only that I guess, so it could be replaced with a unique identifier).

type UserGroupMapper

type UserGroupMapper struct{}

UserGroupMapper is the UserGroup mapper

func NewUserGroupMapper

func NewUserGroupMapper() *UserGroupMapper

NewUserGroupMapper initialize a NewUserGroupMapper

func (UserGroupMapper) AutoIncrementPKey

func (UserGroupMapper) AutoIncrementPKey() bool

AutoIncrementPKey return true if a column of the pkey is autoincremented

func (UserGroupMapper) FieldList

func (mapper UserGroupMapper) FieldList() []qb.Clause

FieldList returns the list of fields for a select

func (*UserGroupMapper) GetMapper

func (mapper *UserGroupMapper) GetMapper() yago.Mapper

GetMapper returns itself

func (UserGroupMapper) LoadAutoIncrementPKeyValue

func (UserGroupMapper) LoadAutoIncrementPKeyValue(instance yago.MappedStruct, value int64)

LoadAutoIncrementPKeyValue set the pkey autoincremented column value

func (*UserGroupMapper) Name

func (*UserGroupMapper) Name() string

Name returns the mapper name

func (UserGroupMapper) PKey

func (mapper UserGroupMapper) PKey(instance yago.MappedStruct) (values []interface{})

PKey returns the instance primary key values

func (UserGroupMapper) PKeyClause

func (mapper UserGroupMapper) PKeyClause(values []interface{}) qb.Clause

PKeyClause returns a clause that matches the instance primary key

func (UserGroupMapper) SQLValues

func (mapper UserGroupMapper) SQLValues(instance yago.MappedStruct, fields ...string) map[string]interface{}

SQLValues returns values as a map The primary key is included only if having non-default values

func (UserGroupMapper) Scan

func (mapper UserGroupMapper) Scan(rows *sql.Rows, instance yago.MappedStruct) error

Scan a struct

func (UserGroupMapper) ScanPKey

func (mapper UserGroupMapper) ScanPKey(rows *sql.Rows, instance yago.MappedStruct) error

ScanPKey scans the primary key only

func (UserGroupMapper) StructType

func (UserGroupMapper) StructType() reflect.Type

StructType returns the reflect.Type of the mapped structure

func (*UserGroupMapper) Table

func (*UserGroupMapper) Table() *qb.TableElem

Table returns the mapper table

type UserGroupModel

type UserGroupModel struct {
	UserID    yago.ScalarField
	GroupID   yago.ScalarField
	ID        yago.ScalarField
	CreatedAt yago.ScalarField
	UpdatedAt yago.ScalarField
	// contains filtered or unexported fields
}

UserGroupModel provides direct access to helpers for UserGroup queries

func NewUserGroupModel

func NewUserGroupModel(meta *yago.Metadata) UserGroupModel

NewUserGroupModel returns a new UserGroupModel

func (UserGroupModel) GetMapper

func (m UserGroupModel) GetMapper() yago.Mapper

GetMapper returns the associated UserGroupMapper instance

type UserMapper

type UserMapper struct{}

UserMapper is the User mapper

func NewUserMapper

func NewUserMapper() *UserMapper

NewUserMapper initialize a NewUserMapper

func (UserMapper) AutoIncrementPKey

func (UserMapper) AutoIncrementPKey() bool

AutoIncrementPKey return true if a column of the pkey is autoincremented

func (UserMapper) FieldList

func (mapper UserMapper) FieldList() []qb.Clause

FieldList returns the list of fields for a select

func (*UserMapper) GetMapper

func (mapper *UserMapper) GetMapper() yago.Mapper

GetMapper returns itself

func (UserMapper) LoadAutoIncrementPKeyValue

func (UserMapper) LoadAutoIncrementPKeyValue(instance yago.MappedStruct, value int64)

LoadAutoIncrementPKeyValue set the pkey autoincremented column value

func (*UserMapper) Name

func (*UserMapper) Name() string

Name returns the mapper name

func (UserMapper) PKey

func (mapper UserMapper) PKey(instance yago.MappedStruct) (values []interface{})

PKey returns the instance primary key values

func (UserMapper) PKeyClause

func (mapper UserMapper) PKeyClause(values []interface{}) qb.Clause

PKeyClause returns a clause that matches the instance primary key

func (UserMapper) SQLValues

func (mapper UserMapper) SQLValues(instance yago.MappedStruct, fields ...string) map[string]interface{}

SQLValues returns values as a map The primary key is included only if having non-default values

func (UserMapper) Scan

func (mapper UserMapper) Scan(rows *sql.Rows, instance yago.MappedStruct) error

Scan a struct

func (UserMapper) ScanPKey

func (mapper UserMapper) ScanPKey(rows *sql.Rows, instance yago.MappedStruct) error

ScanPKey scans the primary key only

func (UserMapper) StructType

func (UserMapper) StructType() reflect.Type

StructType returns the reflect.Type of the mapped structure

func (*UserMapper) Table

func (*UserMapper) Table() *qb.TableElem

Table returns the mapper table

type UserModel

type UserModel struct {
	Name      yago.ScalarField
	Password  yago.ScalarField
	ID        yago.ScalarField
	CreatedAt yago.ScalarField
	UpdatedAt yago.ScalarField
	// contains filtered or unexported fields
}

UserModel provides direct access to helpers for User queries

func NewUserModel

func NewUserModel(meta *yago.Metadata) UserModel

NewUserModel returns a new UserModel

func (UserModel) GetMapper

func (m UserModel) GetMapper() yago.Mapper

GetMapper returns the associated UserMapper instance

Jump to

Keyboard shortcuts

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