repos

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2021 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

+gpa-ignore DO NOT EDIT THIS FILE +gpa-provides:Count,Delete,Find,FindBy,UserRepo,Teacher,RepoTruncate,Update, Generated by gpa at 2021-08-26 14:10:38

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Register

func Register(dialect string, maker interface{})

Types

type Count

type Count interface {
	CountByName(user *models.User) (int64, models.User, error)
	// sql:select count(*) from "user"  where id=:id and age>:age
	CountName(user *models.User, name string) (int64, error)
	// sql:select count(1) where id in :ids and age>:age
	CountXName(user *models.User, name string, ids []uint64) (int64, error)
}

type Delete

type Delete interface {
	DeleteByName(user *models.User, gender bool) (int64, error)
	DeleteByAgeAndCret(user *models.User) (int64, *models.User, error)
	DeleteXByAge(age int, URL string) (int64, models.User, error)

	// sql:delete "user"  where id=:id and age in :ages
	DeleteName(user *models.User, name string, ages []int) (int64, error)
	// sql:delete user   where id = :id and age>:age
	DeleteXName(user *models.User, name string) (int64, error)
	DeleteAll() (int64, models.User, error)
	// sql:where id=:id
	Delete1Name(id uint64) (int64, models.User, error)
	// sql:where id=:id
	Delete2Name(user models.User, id uint64) (int64, error)
}

type Find

type Find interface {
	//sql: select id as id, name name, sum(age) as Age where id=:id group by name
	FindA(ctx context.Context, id uint64) (*models.User, error)
	FindById(id uint64) (models.User, error)
	// sql: select 	* from user where name like :nm
	FindUsers(nm string) ([]*models.User, error)

	// sql: order by name
	FindUsers2(nm string) ([]*models.User, error)

	// sql: select * from user where id in :ids
	FindUsers1(ids []uint64) ([]*models.User, error)
	FindMapByName(name string, kg func(*models.User) (uint64, error)) (map[uint64]*models.User, error)
	FindCbById(id uint64, fn func(*models.User) error) error
	FindMapById(id uint64, fn func(*models.User) (uint64, error)) (map[uint64]*models.User, error)
}

type FindBy

type FindBy interface {
	FindAById(ctx context.Context, id uint64) (*models.User, error)
	FindById(id uint64) (models.User, error)
	FindXuByName(name string) ([]*models.User, error)
	FindMapByName(name string, kg func(*models.User) (uint64, error)) (map[uint64]*models.User, error)
	FindCbById(id uint64, fn func(*models.User) error) error
}

type RepoTruncate

type RepoTruncate interface {
	Truncate(u models.User) error
}

type Repository

type Repository interface {
	Count() Count
	Delete() Delete
	Find() Find
	FindBy() FindBy
	UserRepo() UserRepo
	Teacher() Teacher
	RepoTruncate() RepoTruncate
	Update() Update

	GetProvider() *rt.Provider
	Transaction(fn func() error) error
}

func GetRepository

func GetRepository(p *rt.Provider, dialect ...string) Repository

type Teacher

type Teacher interface {
	InsertTeacher(name string) (*models.Teacher, error)
	Insert1Teacher(tc *models.Teacher) (*models.Teacher, error)

	UpdateByID(tc *models.Teacher) error

	FindByID(id int64) (*models.Teacher, error)
	FindAll() ([]*models.Teacher, error)
	FindMap(kg func(*models.Teacher) (int64, error)) (map[int64]*models.Teacher, error)
	FindCallbck(cb func(*models.Teacher) error) error
}

type Update

type Update interface {
	UpdateXuByIdAndAge(user *models.User) error
	UpdateByName(user *models.User, gender bool) (int64, error)
	UpdateByAgeAndCret(user *models.User) (int64, *models.User, error)
	UpdateXByAge(age int, URL string) (int64, models.User, error)
	// sql:update "user" set  "name"=:name,url=:URL,cret=:cret  where id=:id and age>:age
	UpdateName(user *models.User, name string) (int64, error)
	// sql:update user   where id=:id and age>:age
	UpdateXName(user *models.User, name string) (int64, error)
	UpdateYName(name string) (int64, models.User, error)
	// sql:where id=:id
	Update1Name(name string, id uint64) (int64, models.User, error)
	// sql:where id in :ids or name=:name
	Update2Name(user models.User, ids []uint64) (int64, error)
}

type UserRepo

type UserRepo interface {
	Insert(ctx context.Context, user *models.User, name string) (*models.User, error)
	InsertA(user *models.User) error
	InsertB(user *models.User, name, URL string) (models.User, error)
	InsertC(user *models.User) (*models.User, error)
	InsertUser(name string) (*models.User, error)
}

Directories

Path Synopsis
+gpa-ignore DO NOT EDIT THIS FILE Generated by mro at 2021-08-26 14:10:34 +gpa-ignore DO NOT EDIT THIS FILE Generated by mro at 2021-08-26 14:10:35 +gpa-ignore DO NOT EDIT THIS FILE Generated by gpa at 2021-08-26 14:10:38 +gpa-ignore DO NOT EDIT THIS FILE Generated by mro at 2021-08-26 14:10:35 +gpa-ignore DO NOT EDIT THIS FILE Generated by mro at 2021-08-26 14:10:36 +gpa-ignore DO NOT EDIT THIS FILE Generated by gpa at 2021-08-26 14:10:38 +gpa-ignore DO NOT EDIT THIS FILE Generated by mro at 2021-08-26 14:10:36 +gpa-ignore DO NOT EDIT THIS FILE Generated by mro at 2021-08-26 14:10:37 +gpa-ignore DO NOT EDIT THIS FILE Generated by mro at 2021-08-26 14:10:37 +gpa-ignore DO NOT EDIT THIS FILE Generated by mro at 2021-08-26 14:10:38
+gpa-ignore DO NOT EDIT THIS FILE Generated by mro at 2021-08-26 14:10:34 +gpa-ignore DO NOT EDIT THIS FILE Generated by mro at 2021-08-26 14:10:35 +gpa-ignore DO NOT EDIT THIS FILE Generated by gpa at 2021-08-26 14:10:38 +gpa-ignore DO NOT EDIT THIS FILE Generated by mro at 2021-08-26 14:10:35 +gpa-ignore DO NOT EDIT THIS FILE Generated by mro at 2021-08-26 14:10:36 +gpa-ignore DO NOT EDIT THIS FILE Generated by gpa at 2021-08-26 14:10:38 +gpa-ignore DO NOT EDIT THIS FILE Generated by mro at 2021-08-26 14:10:36 +gpa-ignore DO NOT EDIT THIS FILE Generated by mro at 2021-08-26 14:10:37 +gpa-ignore DO NOT EDIT THIS FILE Generated by mro at 2021-08-26 14:10:37 +gpa-ignore DO NOT EDIT THIS FILE Generated by mro at 2021-08-26 14:10:38

Jump to

Keyboard shortcuts

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