- update dorm

master
李光春 2 years ago
parent e96ca8a00d
commit bfa0593eab

@ -3,7 +3,6 @@ module go.dtapp.net/library
go 1.18
require (
entgo.io/ent v0.11.1
gitee.com/chunanyong/dm v1.8.5
gitee.com/chunanyong/zorm v1.5.6
github.com/aliyun/aliyun-oss-go-sdk v2.2.4+incompatible

@ -36,8 +36,6 @@ cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohl
cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs=
cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0=
dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU=
entgo.io/ent v0.11.1 h1:im67R+2W3Nee2bNS2YnoYz8oAF0Qz4AOlIvKRIAEISY=
entgo.io/ent v0.11.1/go.mod h1:X5b1YfMayrRTgKGO//8IqpL7XJx0uqdeReEkxNpXROA=
gitea.com/xorm/sqlfiddle v0.0.0-20180821085327-62ce714f951a h1:lSA0F4e9A2NcQSqGqTOXqu2aRi/XEQxDCBwM8yJtE6s=
gitea.com/xorm/sqlfiddle v0.0.0-20180821085327-62ce714f951a/go.mod h1:EXuID2Zs0pAQhH8yz+DNjUbjppKQzKFAn28TMYPB6IU=
gitee.com/chunanyong/dm v1.8.5 h1:7RbtxRqZSzMxMT/6vhjdV/Gym2lV2S0PLUUW0ht4ZC4=

@ -1,16 +0,0 @@
package dorm
import (
"entgo.io/ent"
)
type ConfigEntClient struct {
Dns string // 地址
}
// EntClient
// https://entgo.io/
type EntClient struct {
Db *ent.Edge // 驱动
config *ConfigEntClient // 配置
}

@ -1,19 +0,0 @@
package dorm
import (
_ "github.com/go-sql-driver/mysql"
)
func NewEntMysqlClient(config *ConfigEntClient) (*EntClient, error) {
//var err error
//c := &EntClient{config: config}
//client, err := ent.Open("mysql", c.config.Dns)
//if err != nil {
// return nil, errors.New(fmt.Sprintf("连接失败:%v", err))
//}
//defer client.Close()
return nil, nil
}

@ -1,828 +0,0 @@
{
"files": [
"doc/md/contributors.md"
],
"imageSize": 100,
"commit": false,
"contributors": [
{
"login": "a8m",
"name": "Ariel Mashraki",
"avatar_url": "https://avatars.githubusercontent.com/u/7413593?v=4",
"profile": "https://github.com/a8m",
"contributions": [
"maintenance",
"doc",
"code"
]
},
{
"login": "alexsn",
"name": "Alex Snast",
"avatar_url": "https://avatars.githubusercontent.com/u/987019?v=4",
"profile": "https://github.com/alexsn",
"contributions": [
"code"
]
},
{
"login": "rotemtam",
"name": "Rotem Tamir",
"avatar_url": "https://avatars.githubusercontent.com/u/1522681?v=4",
"profile": "https://rotemtam.com/",
"contributions": [
"maintenance",
"doc",
"code"
]
},
{
"login": "cliedeman",
"name": "Ciaran Liedeman",
"avatar_url": "https://avatars.githubusercontent.com/u/3578740?v=4",
"profile": "https://github.com/cliedeman",
"contributions": [
"code"
]
},
{
"login": "marwan-at-work",
"name": "Marwan Sulaiman",
"avatar_url": "https://avatars.githubusercontent.com/u/16294261?v=4",
"profile": "https://www.marwan.io/",
"contributions": [
"code"
]
},
{
"login": "napei",
"name": "Nathaniel Peiffer",
"avatar_url": "https://avatars.githubusercontent.com/u/8946502?v=4",
"profile": "https://nathaniel.peiffer.com.au/",
"contributions": [
"code"
]
},
{
"login": "tmc",
"name": "Travis Cline",
"avatar_url": "https://avatars.githubusercontent.com/u/3977?v=4",
"profile": "https://github.com/tmc",
"contributions": [
"code"
]
},
{
"login": "hantmac",
"name": "Jeremy",
"avatar_url": "https://avatars.githubusercontent.com/u/7600925?v=4",
"profile": "https://cloudsjhan.github.io/",
"contributions": [
"code"
]
},
{
"login": "aca",
"name": "aca",
"avatar_url": "https://avatars.githubusercontent.com/u/50316549?v=4",
"profile": "https://github.com/aca",
"contributions": [
"code"
]
},
{
"login": "BrentChesny",
"name": "BrentChesny",
"avatar_url": "https://avatars.githubusercontent.com/u/1449435?v=4",
"profile": "https://github.com/BrentChesny",
"contributions": [
"code",
"doc"
]
},
{
"login": "giautm",
"name": "Giau. Tran Minh",
"avatar_url": "https://avatars.githubusercontent.com/u/12751435?v=4",
"profile": "https://github.com/giautm",
"contributions": [
"code",
"review"
]
},
{
"login": "htdvisser",
"name": "Hylke Visser",
"avatar_url": "https://avatars.githubusercontent.com/u/181308?v=4",
"profile": "https://htdvisser.dev/",
"contributions": [
"code"
]
},
{
"login": "kerbelp",
"name": "Pavel Kerbel",
"avatar_url": "https://avatars.githubusercontent.com/u/3934990?v=4",
"profile": "https://github.com/kerbelp",
"contributions": [
"code"
]
},
{
"login": "day-dreams",
"name": "zhangnan",
"avatar_url": "https://avatars.githubusercontent.com/u/24593904?v=4",
"profile": "https://github.com/day-dreams",
"contributions": [
"code"
]
},
{
"login": "uta-mori",
"name": "mori yuta",
"avatar_url": "https://avatars.githubusercontent.com/u/59682979?v=4",
"profile": "https://github.com/uta-mori",
"contributions": [
"code",
"translation",
"review"
]
},
{
"login": "chris-rock",
"name": "Christoph Hartmann",
"avatar_url": "https://avatars.githubusercontent.com/u/1178413?v=4",
"profile": "http://lollyrock.com/",
"contributions": [
"code"
]
},
{
"login": "rubensayshi",
"name": "Ruben de Vries",
"avatar_url": "https://avatars.githubusercontent.com/u/649160?v=4",
"profile": "https://github.com/rubensayshi",
"contributions": [
"code"
]
},
{
"login": "ernado",
"name": "Aleksandr Razumov",
"avatar_url": "https://avatars.githubusercontent.com/u/866677?v=4",
"profile": "https://keybase.io/ernado",
"contributions": [
"code"
]
},
{
"login": "apbuteau",
"name": "apbuteau",
"avatar_url": "https://avatars.githubusercontent.com/u/6796073?v=4",
"profile": "https://github.com/apbuteau",
"contributions": [
"code"
]
},
{
"login": "ichord",
"name": "Harold.Luo",
"avatar_url": "https://avatars.githubusercontent.com/u/1324791?v=4",
"profile": "https://github.com/ichord",
"contributions": [
"code"
]
},
{
"login": "idoshveki",
"name": "ido shveki",
"avatar_url": "https://avatars.githubusercontent.com/u/11615669?v=4",
"profile": "https://github.com/idoshveki",
"contributions": [
"code"
]
},
{
"login": "masseelch",
"name": "MasseElch",
"avatar_url": "https://avatars.githubusercontent.com/u/12862103?v=4",
"profile": "https://github.com/masseelch",
"contributions": [
"code"
]
},
{
"login": "kidlj",
"name": "Jian Li",
"avatar_url": "https://avatars.githubusercontent.com/u/300616?v=4",
"profile": "https://github.com/kidlj",
"contributions": [
"code"
]
},
{
"login": "nolotz",
"name": "Noah-Jerome Lotzer",
"avatar_url": "https://avatars.githubusercontent.com/u/5778728?v=4",
"profile": "https://noah.je/",
"contributions": [
"code"
]
},
{
"login": "danf0rth",
"name": "danforth",
"avatar_url": "https://avatars.githubusercontent.com/u/14220891?v=4",
"profile": "https://github.com/danf0rth",
"contributions": [
"code"
]
},
{
"login": "maxiloEmmmm",
"name": "maxilozoz",
"avatar_url": "https://avatars.githubusercontent.com/u/16779121?v=4",
"profile": "https://github.com/maxiloEmmmm",
"contributions": [
"code"
]
},
{
"login": "zzwx",
"name": "zzwx",
"avatar_url": "https://avatars.githubusercontent.com/u/8169082?v=4",
"profile": "https://gist.github.com/zzwx",
"contributions": [
"code"
]
},
{
"login": "ix64",
"name": "MengYX",
"avatar_url": "https://avatars.githubusercontent.com/u/13902388?v=4",
"profile": "https://github.com/ix64",
"contributions": [
"translation"
]
},
{
"login": "mattn",
"name": "mattn",
"avatar_url": "https://avatars.githubusercontent.com/u/10111?v=4",
"profile": "https://mattn.kaoriya.net/",
"contributions": [
"translation"
]
},
{
"login": "Bladrak",
"name": "Hugo Briand",
"avatar_url": "https://avatars.githubusercontent.com/u/1321977?v=4",
"profile": "https://github.com/Bladrak",
"contributions": [
"code"
]
},
{
"login": "enmand",
"name": "Dan Enman",
"avatar_url": "https://avatars.githubusercontent.com/u/432487?v=4",
"profile": "https://danielenman.com/",
"contributions": [
"code"
]
},
{
"login": "UnAfraid",
"name": "Rumen Nikiforov",
"avatar_url": "https://avatars.githubusercontent.com/u/2185291?v=4",
"profile": "http://www.l2junity.org/",
"contributions": [
"code"
]
},
{
"login": "wenerme",
"name": "陈杨文",
"avatar_url": "https://avatars.githubusercontent.com/u/1777211?v=4",
"profile": "https://wener.me",
"contributions": [
"code"
]
},
{
"login": "joesonw",
"name": "Qiaosen (Joeson) Huang",
"avatar_url": "https://avatars.githubusercontent.com/u/1635441?v=4",
"profile": "https://djwong.net",
"contributions": [
"bug"
]
},
{
"login": "davebehr1",
"name": "AlonDavidBehr",
"avatar_url": "https://avatars.githubusercontent.com/u/16716239?v=4",
"profile": "https://github.com/davebehr1",
"contributions": [
"code",
"review"
]
},
{
"login": "DuGlaser",
"name": "DuGlaser",
"avatar_url": "https://avatars.githubusercontent.com/u/50506482?v=4",
"profile": "http://duglaser.dev",
"contributions": [
"doc"
]
},
{
"login": "shanna",
"name": "Shane Hanna",
"avatar_url": "https://avatars.githubusercontent.com/u/28489?v=4",
"profile": "https://github.com/shanna",
"contributions": [
"doc"
]
},
{
"login": "mahmud2011",
"name": "Mahmudul Haque",
"avatar_url": "https://avatars.githubusercontent.com/u/5278142?v=4",
"profile": "https://www.linkedin.com/in/mahmud2011",
"contributions": [
"code"
]
},
{
"login": "sywesk",
"name": "Benjamin Bourgeais",
"avatar_url": "https://avatars.githubusercontent.com/u/862607?v=4",
"profile": "http://blog.scaleprocess.net",
"contributions": [
"code"
]
},
{
"login": "8ayac",
"name": "8ayac(Yoshinori Hayashi)",
"avatar_url": "https://avatars.githubusercontent.com/u/29266382?v=4",
"profile": "https://about.8ay.ac/",
"contributions": [
"doc"
]
},
{
"login": "y-yagi",
"name": "y-yagi",
"avatar_url": "https://avatars.githubusercontent.com/u/987638?v=4",
"profile": "https://github.com/y-yagi",
"contributions": [
"doc"
]
},
{
"login": "Sacro",
"name": "Ben Woodward",
"avatar_url": "https://avatars.githubusercontent.com/u/2659869?v=4",
"profile": "https://github.com/Sacro",
"contributions": [
"code"
]
},
{
"login": "wzyjerry",
"name": "WzyJerry",
"avatar_url": "https://avatars.githubusercontent.com/u/11435169?v=4",
"profile": "https://github.com/wzyjerry",
"contributions": [
"code"
]
},
{
"login": "tarrencev",
"name": "Tarrence van As",
"avatar_url": "https://avatars.githubusercontent.com/u/4740651?v=4",
"profile": "https://github.com/tarrencev",
"contributions": [
"doc",
"code"
]
},
{
"login": "MONAKA0721",
"name": "Yuya Sumie",
"avatar_url": "https://avatars.githubusercontent.com/u/32859963?v=4",
"profile": "https://mo7ka.com",
"contributions": [
"doc"
]
},
{
"login": "akfaew",
"name": "Michal Mazurek",
"avatar_url": "https://avatars.githubusercontent.com/u/7853732?v=4",
"profile": "http://jasminek.net",
"contributions": [
"code"
]
},
{
"login": "nmemoto",
"name": "Takafumi Umemoto",
"avatar_url": "https://avatars.githubusercontent.com/u/1522332?v=4",
"profile": "https://github.com/nmemoto",
"contributions": [
"doc"
]
},
{
"login": "squarebat",
"name": "Khadija Sidhpuri",
"avatar_url": "https://avatars.githubusercontent.com/u/59063821?v=4",
"profile": "http://www.linkedin.com/in/khadija-sidhpuri-87709316a",
"contributions": [
"code"
]
},
{
"login": "neel229",
"name": "Neel Modi",
"avatar_url": "https://avatars.githubusercontent.com/u/53475167?v=4",
"profile": "https://github.com/neel229",
"contributions": [
"code"
]
},
{
"login": "shomodj",
"name": "Boris Shomodjvarac",
"avatar_url": "https://avatars.githubusercontent.com/u/304768?v=4",
"profile": "https://ie.linkedin.com/in/boris-shomodjvarac-51970879",
"contributions": [
"doc"
]
},
{
"login": "sadmansakib",
"name": "Sadman Sakib",
"avatar_url": "https://avatars.githubusercontent.com/u/17023844?v=4",
"profile": "https://github.com/sadmansakib",
"contributions": [
"doc"
]
},
{
"login": "dakimura",
"name": "dakimura",
"avatar_url": "https://avatars.githubusercontent.com/u/34202807?v=4",
"profile": "https://github.com/dakimura",
"contributions": [
"code"
]
},
{
"login": "RiskyFeryansyahP",
"name": "Risky Feryansyah",
"avatar_url": "https://avatars.githubusercontent.com/u/36788585?v=4",
"profile": "https://github.com/RiskyFeryansyahP",
"contributions": [
"code"
]
},
{
"login": "seiichi1101",
"name": "seiichi ",
"avatar_url": "https://avatars.githubusercontent.com/u/20941952?v=4",
"profile": "https://github.com/seiichi1101",
"contributions": [
"code"
]
},
{
"login": "odeke-em",
"name": "Emmanuel T Odeke",
"avatar_url": "https://avatars.githubusercontent.com/u/4898263?v=4",
"profile": "https://orijtech.com/",
"contributions": [
"code"
]
},
{
"login": "isoppp",
"name": "Hiroki Isogai",
"avatar_url": "https://avatars.githubusercontent.com/u/16318727?v=4",
"profile": "https://isoppp.com",
"contributions": [
"doc"
]
},
{
"login": "tsingsun",
"name": "李清山",
"avatar_url": "https://avatars.githubusercontent.com/u/5848549?v=4",
"profile": "https://github.com/tsingsun",
"contributions": [
"code"
]
},
{
"login": "s-takehana",
"name": "s-takehana",
"avatar_url": "https://avatars.githubusercontent.com/u/3423547?v=4",
"profile": "https://github.com/s-takehana",
"contributions": [
"doc"
]
},
{
"login": "EndlessIdea",
"name": "Kuiba",
"avatar_url": "https://avatars.githubusercontent.com/u/1527796?v=4",
"profile": "https://github.com/EndlessIdea",
"contributions": [
"code"
]
},
{
"login": "storyicon",
"name": "storyicon",
"avatar_url": "https://avatars.githubusercontent.com/u/29772821?v=4",
"profile": "https://github.com/storyicon",
"contributions": [
"code"
]
},
{
"login": "evanlurvey",
"name": "Evan Lurvey",
"avatar_url": "https://avatars.githubusercontent.com/u/54965655?v=4",
"profile": "https://github.com/evanlurvey",
"contributions": [
"code"
]
},
{
"login": "attackordie",
"name": "Brian",
"avatar_url": "https://avatars.githubusercontent.com/u/20145334?v=4",
"profile": "https://github.com/attackordie",
"contributions": [
"doc"
]
},
{
"login": "ThinkontrolSY",
"name": "Shen Yang",
"avatar_url": "https://avatars.githubusercontent.com/u/11331554?v=4",
"profile": "http://www.thinkontrol.com",
"contributions": [
"code"
]
},
{
"login": "sivchari",
"name": "sivchari",
"avatar_url": "https://avatars.githubusercontent.com/u/55221074?v=4",
"profile": "https://twitter.com/sivchari",
"contributions": [
"code"
]
},
{
"login": "mookjp",
"name": "mook",
"avatar_url": "https://avatars.githubusercontent.com/u/1519309?v=4",
"profile": "https://blog.mookjp.io",
"contributions": [
"code"
]
},
{
"login": "heliumbrain",
"name": "heliumbrain",
"avatar_url": "https://avatars.githubusercontent.com/u/1607668?v=4",
"profile": "http://www.entiros.se",
"contributions": [
"doc"
]
},
{
"login": "JeremyV2014",
"name": "Jeremy Maxey-Vesperman",
"avatar_url": "https://avatars.githubusercontent.com/u/9276415?v=4",
"profile": "https://github.com/JeremyV2014",
"contributions": [
"code",
"doc"
]
},
{
"login": "tankbusta",
"name": "Christopher Schmitt",
"avatar_url": "https://avatars.githubusercontent.com/u/592749?v=4",
"profile": "https://github.com/tankbusta",
"contributions": [
"doc"
]
},
{
"login": "grevych",
"name": "Gerardo Reyes",
"avatar_url": "https://avatars.githubusercontent.com/u/3792003?v=4",
"profile": "https://github.com/grevych",
"contributions": [
"code"
]
},
{
"login": "naormatania",
"name": "Naor Matania",
"avatar_url": "https://avatars.githubusercontent.com/u/6978437?v=4",
"profile": "https://github.com/naormatania",
"contributions": [
"code"
]
},
{
"login": "idc77",
"name": "idc77",
"avatar_url": "https://avatars.githubusercontent.com/u/87644834?v=4",
"profile": "https://github.com/idc77",
"contributions": [
"doc"
]
},
{
"login": "HurSungYun",
"name": "Sungyun Hur",
"avatar_url": "https://avatars.githubusercontent.com/u/8033896?v=4",
"profile": "http://ethanhur.me",
"contributions": [
"doc"
]
},
{
"login": "peanut-cc",
"name": "peanut-pg",
"avatar_url": "https://avatars.githubusercontent.com/u/55480838?v=4",
"profile": "https://github.com/peanut-cc",
"contributions": [
"doc"
]
},
{
"login": "m3hm3t",
"name": "Mehmet Yılmaz",
"avatar_url": "https://avatars.githubusercontent.com/u/22320354?v=4",
"profile": "https://github.com/m3hm3t",
"contributions": [
"code"
]
},
{
"login": "Laconty",
"name": "Roman Maklakov",
"avatar_url": "https://avatars.githubusercontent.com/u/17760166?v=4",
"profile": "https://github.com/Laconty",
"contributions": [
"code"
]
},
{
"login": "genevieve",
"name": "Genevieve",
"avatar_url": "https://avatars.githubusercontent.com/u/12158641?v=4",
"profile": "https://github.com/genevieve",
"contributions": [
"code"
]
},
{
"login": "cjraa",
"name": "Clarence",
"avatar_url": "https://avatars.githubusercontent.com/u/62199269?v=4",
"profile": "https://github.com/cjraa",
"contributions": [
"code"
]
},
{
"login": "iamnande",
"name": "Nicholas Anderson",
"avatar_url": "https://avatars.githubusercontent.com/u/7806510?v=4",
"profile": "https://www.linkedin.com/in/iamnande/",
"contributions": [
"code"
]
},
{
"login": "hezhizhen",
"name": "Zhizhen He",
"avatar_url": "https://avatars.githubusercontent.com/u/7611700?v=4",
"profile": "https://github.com/hezhizhen",
"contributions": [
"code"
]
},
{
"login": "crossworth",
"name": "Pedro Henrique",
"avatar_url": "https://avatars.githubusercontent.com/u/1251151?v=4",
"profile": "https://pedro.dev.br",
"contributions": [
"code"
]
},
{
"login": "MrParano1d",
"name": "MrParano1d",
"avatar_url": "https://avatars.githubusercontent.com/u/7414374?v=4",
"profile": "https://2jp.de",
"contributions": [
"code"
]
},
{
"login": "tprebs",
"name": "Thomas Prebble",
"avatar_url": "https://avatars.githubusercontent.com/u/6523587?v=4",
"profile": "https://github.com/tprebs",
"contributions": [
"code"
]
},
{
"login": "imhuytq",
"name": "Huy TQ",
"avatar_url": "https://avatars.githubusercontent.com/u/5723282?v=4",
"profile": "https://huytq.com",
"contributions": [
"code"
]
},
{
"login": "maorlipchuk",
"name": "maorlipchuk",
"avatar_url": "https://avatars.githubusercontent.com/u/7034637?v=4",
"profile": "https://github.com/maorlipchuk",
"contributions": [
"code"
]
},
{
"login": "iwata",
"name": "Motonori Iwata",
"avatar_url": "https://avatars.githubusercontent.com/u/121048?v=4",
"profile": "https://mobcov.hatenadiary.org/",
"contributions": [
"doc"
]
},
{
"login": "CharlesGe129",
"name": "Charles Ge",
"avatar_url": "https://avatars.githubusercontent.com/u/20162173?v=4",
"profile": "https://github.com/CharlesGe129",
"contributions": [
"code"
]
},
{
"login": "thmeitz",
"name": "Thomas Meitz",
"avatar_url": "https://avatars.githubusercontent.com/u/92851940?v=4",
"profile": "https://github.com/thmeitz",
"contributions": [
"code",
"doc"
]
},
{
"login": "booleangate",
"name": "Justin Johnson",
"avatar_url": "https://avatars.githubusercontent.com/u/181567?v=4",
"profile": "http://justinjohnson.org",
"contributions": [
"code"
]
},
{
"login": "hax10",
"name": "hax10",
"avatar_url": "https://avatars.githubusercontent.com/u/85743468?v=4",
"profile": "https://github.com/hax10",
"contributions": [
"code"
]
}
],
"contributorsPerLine": 7,
"projectName": "ent",
"projectOwner": "ent",
"repoType": "github",
"repoHost": "https://github.com",
"skipCi": true
}

75
vendor/entgo.io/ent/.golangci.yml generated vendored

@ -1,75 +0,0 @@
run:
go: '1.17'
timeout: 5m
linters-settings:
errcheck:
ignore: fmt:.*,Read|Write|Close|Exec,io:Copy
dupl:
threshold: 100
funlen:
lines: 115
statements: 115
goheader:
template: |-
Copyright 2019-present Facebook Inc. All rights reserved.
This source code is licensed under the Apache 2.0 license found
in the LICENSE file in the root directory of this source tree.
linters:
disable-all: true
enable:
- bodyclose
- deadcode
- depguard
- dogsled
- dupl
- errcheck
- funlen
- gocritic
- gofmt
- goheader
- gosec
- gosimple
- govet
- ineffassign
- misspell
- staticcheck
- structcheck
- stylecheck
- typecheck
- unconvert
- unused
- varcheck
- whitespace
issues:
exclude-rules:
- path: _test\.go
linters:
- dupl
- funlen
- gosec
- gocritic
- linters:
- unused
source: ent.Schema
- path: dialect/sql/schema
linters:
- dupl
- gosec
- text: "Expect WriteFile permissions to be 0600 or less"
linters:
- gosec
- path: privacy/privacy.go
linters:
- stylecheck
- path: entc/load/schema.go
linters:
- staticcheck
- path: entc/gen/graph.go
linters:
- gocritic
- path: entc/integration/multischema/multischema_test.go
linters:
- staticcheck
text: SA1019

@ -1,77 +0,0 @@
# Code of Conduct
## Our Pledge
In the interest of fostering an open and welcoming environment, we as
contributors and maintainers pledge to make participation in our project and
our community a harassment-free experience for everyone, regardless of age, body
size, disability, ethnicity, sex characteristics, gender identity and expression,
level of experience, education, socio-economic status, nationality, personal
appearance, race, religion, or sexual identity and orientation.
## Our Standards
Examples of behavior that contributes to creating a positive environment
include:
* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members
Examples of unacceptable behavior by participants include:
* The use of sexualized language or imagery and unwelcome sexual attention or
advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic
address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting
## Our Responsibilities
Project maintainers are responsible for clarifying the standards of acceptable
behavior and are expected to take appropriate and fair corrective action in
response to any instances of unacceptable behavior.
Project maintainers have the right and responsibility to remove, edit, or
reject comments, commits, code, wiki edits, issues, and other contributions
that are not aligned to this Code of Conduct, or to ban temporarily or
permanently any contributor for other behaviors that they deem inappropriate,
threatening, offensive, or harmful.
## Scope
This Code of Conduct applies within all project spaces, and it also applies when
an individual is representing the project or its community in public spaces.
Examples of representing a project or community include using an official
project e-mail address, posting via an official social media account, or acting
as an appointed representative at an online or offline event. Representation of
a project may be further defined and clarified by project maintainers.
## Enforcement
Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported by contacting the project team at <opensource-conduct@fb.com>. All
complaints will be reviewed and investigated and will result in a response that
is deemed necessary and appropriate to the circumstances. The project team is
obligated to maintain confidentiality with regard to the reporter of an incident.
Further details of specific enforcement policies may be posted separately.
Project maintainers who do not follow or enforce the Code of Conduct in good
faith may face temporary or permanent repercussions as determined by other
members of the project's leadership.
## Attribution
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
[homepage]: https://www.contributor-covenant.org
For answers to common questions about this code of conduct, see
https://www.contributor-covenant.org/faq

@ -1,69 +0,0 @@
# Contributing to ent
We want to make contributing to this project as easy and transparent as
possible.
# Project structure
- `dialect` - Contains SQL and Gremlin code used by the generated code.
- `dialect/sql/schema` - Auto migration logic resides there.
- `schema` - User schema API.
- `schema/{field, edge, index, mixin}` - provides schema builders API.
- `schema/field/gen` - Templates and codegen for numeric builders.
- `entc` - Codegen of `ent`.
- `entc/load` - `entc` loader API for loading user schemas into a Go objects at runtime.
- `entc/gen` - The actual code generation logic resides in this package (and its `templates` package).
- `integration` - Integration tests for `entc`.
- `privacy` - Runtime code for [privacy layer](https://entgo.io/docs/privacy/).
- `doc` - Documentation code for `entgo.io` (uses [Docusaurus](https://docusaurus.io)).
- `doc/md` - Markdown files for documentation.
- `doc/website` - Website code and assets.
In order to test your documentation changes, run `npm start` from the `doc/website` directory, and open [localhost:3000](http://localhost:3000/).
# Run integration tests
If you touch any file in `entc`, run the following command in `entc`:
```
go generate ./...
```
Then, in `entc/integration` run `docker-compose` in order to spin-up all database containers:
```
docker-compose -f docker-compose.yaml up -d
```
Then, run `go test ./...` to run all integration tests.
## Pull Requests
We actively welcome your pull requests.
1. Fork the repo and create your branch from `master`.
2. If you've added code that should be tested, add tests.
3. If you've changed APIs, update the documentation.
4. Ensure the test suite passes.
5. Make sure your code lints.
6. If you haven't already, complete the Contributor License Agreement ("CLA").
## Contributor License Agreement ("CLA")
In order to accept your pull request, we need you to submit a CLA. You only need
to do this once to work on any of Facebook's open source projects.
Complete your CLA here: <https://code.facebook.com/cla>
## Issues
We use GitHub issues to track public bugs. Please ensure your description is
clear and has sufficient instructions to be able to reproduce the issue.
Facebook has a [bounty program](https://www.facebook.com/whitehat/) for the safe
disclosure of security bugs. In those cases, please go through the process
outlined on that page and do not file a public issue.
## License
By contributing to ent, you agree that your contributions will be licensed
under the LICENSE file in the root directory of this source tree.

202
vendor/entgo.io/ent/LICENSE generated vendored

@ -1,202 +0,0 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

58
vendor/entgo.io/ent/README.md generated vendored

@ -1,58 +0,0 @@
## ent - An Entity Framework For Go
[![Twitter](https://img.shields.io/twitter/url/https/twitter.com/entgo_io.svg?style=social&label=Follow%20%40entgo_io)](https://twitter.com/entgo_io)
[![Discord](https://img.shields.io/discord/885059418646003782?label=discord&logo=discord&style=flat-square&logoColor=white)](https://discord.gg/qZmPgTE6RX)
[English](README.md) | [中文](README_zh.md) | [日本語](README_jp.md)
<img width="50%"
align="right"
style="display: block; margin:40px auto;"
src="https://s3.eu-central-1.amazonaws.com/entgo.io/assets/gopher_graph.png"/>
Simple, yet powerful entity framework for Go, that makes it easy to build and maintain applications
with large data-models.
- **Schema As Code** - model any database schema as Go objects.
- **Easily Traverse Any Graph** - run queries, aggregations and traverse any graph structure easily.
- **Statically Typed And Explicit API** - 100% statically typed and explicit API using code generation.
- **Multi Storage Driver** - supports MySQL, MariaDB, TiDB, PostgreSQL, CockroachDB, SQLite and Gremlin.
- **Extendable** - simple to extend and customize using Go templates.
## Quick Installation
```console
go install entgo.io/ent/cmd/ent@latest
```
For proper installation using [Go modules], visit [entgo.io website][entgo instal].
## Docs and Support
The documentation for developing and using ent is available at: https://entgo.io
For discussion and support, [open an issue](https://github.com/ent/ent/issues/new/choose) or join our [channel](https://gophers.slack.com/archives/C01FMSQDT53) in the gophers Slack.
## Join the ent Community
Building `ent` would not have been possible without the collective work of our entire community. We maintain a [contributors page](doc/md/contributors.md)
which lists the contributors to this `ent`.
In order to contribute to `ent`, see the [CONTRIBUTING](CONTRIBUTING.md) file for how to go get started.
If your company or your product is using `ent`, please let us know by adding yourself to the [ent users page](https://github.com/ent/ent/wiki/ent-users).
For updates, follow us on Twitter at https://twitter.com/entgo_io
## About the Project
The `ent` project was inspired by Ent, an entity framework we use internally. It is developed and maintained
by [a8m](https://github.com/a8m) and [alexsn](https://github.com/alexsn)
from the [Facebook Connectivity][fbc] team. It is used by multiple teams and projects in production,
and the roadmap for its v1 release is described [here](https://github.com/ent/ent/issues/46).
Read more about the motivation of the project [here](https://entgo.io/blog/2019/10/03/introducing-ent).
## License
ent is licensed under Apache 2.0 as found in the [LICENSE file](LICENSE).
[entgo instal]: https://entgo.io/docs/code-gen/#version-compatibility-between-entc-and-ent
[Go modules]: https://github.com/golang/go/wiki/Modules#quick-start
[fbc]: https://connectivity.fb.com

54
vendor/entgo.io/ent/README_jp.md generated vendored

@ -1,54 +0,0 @@
## ent - Goのエンティティーフレームワーク
[![Twitter](https://img.shields.io/twitter/url/https/twitter.com/entgo_io.svg?style=social&label=Follow%20%40entgo_io)](https://twitter.com/entgo_io)
[English](README.md) | [中文](README_zh.md) | [日本語](README_jp.md)
<img width="50%"
align="right"
style="display: block; margin:40px auto;"
src="https://s3.eu-central-1.amazonaws.com/entgo.io/assets/gopher_graph.png"/>
シンプルながらもパワフルなGoのエンティティフレームワークであり、大規模なデータモデルを持つアプリケーションを容易に構築・保守できるようにします。
- **Schema As Code(コードとしてのスキーマ)** - あらゆるデータベーススキーマをGoオブジェクトとしてモデル化します。
- **任意のグラフを簡単にトラバースできます** - クエリや集約の実行、任意のグラフ構造の走査を容易に実行できます。
- **100%静的に型付けされた明示的なAPI** - コード生成により、100%静的に型付けされた曖昧さのないAPIを提供します。
- **マルチストレージドライバ** - MySQL、PostgreSQL、SQLite、Gremlinをサポートしています。
- **拡張性** - Goテンプレートを使用して簡単に拡張、カスタマイズできます。
## クイックインストール
```console
go install entgo.io/ent/cmd/ent@latest
```
[Go modules]を使ったインストールについては、[entgo.io website][entgo instal]をご覧ください。
## ドキュメントとサポート
entを開発・使用するためのドキュメントは、こちら。: https://entgo.io
議論やサポートについては、[Issueを立てる](https://github.com/ent/ent/issues/new/choose)か、gophers Slackの[チャンネル](https://gophers.slack.com/archives/C01FMSQDT53)に参加してください。
## entコミュニティへの参加
`ent`の構築は、コミュニティ全体の協力なしには実現できませんでした。 私たちは、この`ent`の貢献者をリストアップした[contributorsページ](doc/md/contributors.md)を管理しています。
`ent`に貢献するときは、まず[CONTRIBUTING](CONTRIBUTING.md)を参照してください。
もし、あなたの会社や製品で`ent`を利用している場合は、[ent usersページ](https://github.com/ent/ent/wiki/ent-users)に追記する形で、そのことをぜひ教えて下さい。
最新情報については、Twitter(<https://twitter.com/entgo_io>)をフォローしてください。
## プロジェクトについて
`ent`プロジェクトは、私たちが社内で使用しているエンティティフレームワークである`Ent`からインスピレーションを得ています。
entは、[Facebook Connectivity][fbc]チームの[a8m](https://github.com/a8m)と[alexsn](https://github.com/alexsn)が開発・保守しています。
本番環境では複数のチームやプロジェクトで使用されており、v1リリースまでのロードマップは[こちら](https://github.com/ent/ent/issues/46)に記載されています。
このプロジェクトの動機については[こちら](https://entgo.io/blog/2019/10/03/introducing-ent)をご覧ください。
## ライセンス
entは、[LICENSEファイル](LICENSE)にもある通り、Apache 2.0でライセンスされています。
[entgo instal]: https://entgo.io/docs/code-gen/#version-compatibility-between-entc-and-ent
[Go modules]: https://github.com/golang/go/wiki/Modules#quick-start
[fbc]: https://connectivity.fb.com

44
vendor/entgo.io/ent/README_zh.md generated vendored

@ -1,44 +0,0 @@
## ent - 一个强大的Go语言实体框架
[English](README.md) | [中文](README_zh.md) | [日本語](README_jp.md)
<img width="50%"
align="right"
style="display: block; margin:40px auto;"
src="https://s3.eu-central-1.amazonaws.com/entgo.io/assets/gopher_graph.png"/>
ent是一个简单而又功能强大的Go语言实体框架ent易于构建和维护应用程序与大数据模型。
- **图就是代码** - 将任何数据库表建模为Go对象。
- **轻松地遍历任何图形** - 可以轻松地运行查询、聚合和遍历任何图形结构。
- **静态类型和显式API** - 使用代码生成静态类型和显式API查询数据更加便捷。
- **多存储驱动程序** - 支持MySQL, PostgreSQL, SQLite 和 Gremlin。
- **可扩展** - 简单地扩展和使用Go模板自定义。
## 快速安装
```console
go install entgo.io/ent/cmd/ent@latest
```
请访问[entgo.io website][entgo instal]以使用[Go modules]进行正确安装。
## 文档和支持
开发和使用ent的文档请参照 https://entgo.io
如要讨论问题和支持, [创建一个issue](https://github.com/ent/ent/issues/new/choose) 或者加入我们的Gopher Slack(Slack软件,类似于论坛)[讨论组](https://gophers.slack.com/archives/C01FMSQDT53)
## 加入 ent 社区
如果你想为`ent`做出贡献, [贡献代码](CONTRIBUTING.md) 中写了如何做出自己的贡献
如果你的公司或者产品在使用`ent`,请让我们知道你已经加入 [ent 用户](https://github.com/ent/ent/wiki/ent-users)
## 关于项目
`ent` 项目灵感来自于EntEnt是一个facebook内部使用的一个实体框架项目。 它由 [Facebook Connectivity][fbc] 团队通过 [a8m](https://github.com/a8m) 和 [alexsn](https://github.com/alexsn) 开发和维护
, 它被生产中的多个团队和项目使用。它的v1版本的路线图为 [版本的路线图](https://github.com/ent/ent/issues/46).
关于项目更多的信息 [ent介绍](https://entgo.io/blog/2019/10/03/introducing-ent)。
## 声明
ent使用Apache 2.0协议授权,可以在[LICENSE文件](LICENSE)中找到。
[entgo instal]: https://entgo.io/docs/code-gen/#version-compatibility-between-entc-and-ent
[Go modules]: https://github.com/golang/go/wiki/Modules#quick-start
[fbc]: https://connectivity.fb.com

365
vendor/entgo.io/ent/ent.go generated vendored

@ -1,365 +0,0 @@
// Copyright 2019-present Facebook Inc. All rights reserved.
// This source code is licensed under the Apache 2.0 license found
// in the LICENSE file in the root directory of this source tree.
// Package ent is the interface between end-user schemas and entc (ent codegen).
package ent
import (
"context"
"entgo.io/ent/schema"
"entgo.io/ent/schema/edge"
"entgo.io/ent/schema/field"
"entgo.io/ent/schema/index"
)
type (
// The Interface type describes the requirements for an exported type defined in the schema package.
// It functions as the interface between the user's schema types and codegen loader.
// Users should use the Schema type for embedding as follows:
//
// type T struct {
// ent.Schema
// }
//
Interface interface {
// Type is a dummy method, that is used in edge declaration.
//
// The Type method should be used as follows:
//
// type S struct { ent.Schema }
//
// type T struct { ent.Schema }
//
// func (T) Edges() []ent.Edge {
// return []ent.Edge{
// edge.To("S", S.Type),
// }
// }
//
Type()
// Fields returns the fields of the schema.
Fields() []Field
// Edges returns the edges of the schema.
Edges() []Edge
// Indexes returns the indexes of the schema.
Indexes() []Index
// Config returns an optional config for the schema.
//
// Deprecated: the Config method predates the Annotations method, and it
// is planned be removed in v0.5.0. New code should use Annotations instead.
//
// func (T) Annotations() []schema.Annotation {
// return []schema.Annotation{
// entsql.Annotation{Table: "Name"},
// }
// }
//
Config() Config
// Mixin returns an optional list of Mixin to extends
// the schema.
Mixin() []Mixin
// Hooks returns an optional list of Hook to apply on
// mutations.
Hooks() []Hook
// Policy returns the privacy policy of the schema.
Policy() Policy
// Annotations returns a list of schema annotations to be used by
// codegen extensions.
Annotations() []schema.Annotation
}
// A Field interface returns a field descriptor for vertex fields/properties.
// The usage for the interface is as follows:
//
// func (T) Fields() []ent.Field {
// return []ent.Field{
// field.Int("int"),
// }
// }
//
Field interface {
Descriptor() *field.Descriptor
}
// An Edge interface returns an edge descriptor for vertex edges.
// The usage for the interface is as follows:
//
// func (T) Edges() []ent.Edge {
// return []ent.Edge{
// edge.To("S", S.Type),
// }
// }
//
Edge interface {
Descriptor() *edge.Descriptor
}
// An Index interface returns an index descriptor for vertex indexes.
// The usage for the interface is as follows:
//
// func (T) Indexes() []ent.Index {
// return []ent.Index{
// index.Fields("f1", "f2").
// Unique(),
// }
// }
//
Index interface {
Descriptor() *index.Descriptor
}
// A Config structure is used to configure an entity schema.
// The usage of this structure is as follows:
//
// func (T) Config() ent.Config {
// return ent.Config{
// Table: "Name",
// }
// }
//
// Deprecated: the Config object predates the schema.Annotation method and it
// is planned be removed in v0.5.0. New code should use Annotations instead.
//
// func (T) Annotations() []schema.Annotation {
// return []schema.Annotation{
// entsql.Annotation{Table: "Name"},
// }
// }
//
Config struct {
// A Table is an optional table name defined for the schema.
Table string
}
// The Mixin type describes a set of methods that can extend
// other methods in the schema without calling them directly.
//
// type TimeMixin struct {}
//
// func (TimeMixin) Fields() []ent.Field {
// return []ent.Field{
// field.Time("created_at").
// Immutable().
// Default(time.Now),
// field.Time("updated_at").
// Default(time.Now).
// UpdateDefault(time.Now),
// }
// }
//
// type T struct {
// ent.Schema
// }
//
// func(T) Mixin() []ent.Mixin {
// return []ent.Mixin{
// TimeMixin{},
// }
// }
//
Mixin interface {
// Fields returns a slice of fields to add to the schema.
Fields() []Field
// Edges returns a slice of edges to add to the schema.
Edges() []Edge
// Indexes returns a slice of indexes to add to the schema.
Indexes() []Index
// Hooks returns a slice of hooks to add to the schema.
// Note that mixin hooks are executed before schema hooks.
Hooks() []Hook
// Policy returns a privacy policy to add to the schema.
// Note that mixin policy are executed before schema policy.
Policy() Policy
// Annotations returns a list of schema annotations to add
// to the schema annotations.
Annotations() []schema.Annotation
}
// The Policy type defines the write privacy policy of an entity.
// The usage for the interface is as follows:
//
// type T struct {
// ent.Schema
// }
//
// func(T) Policy() ent.Policy {
// return privacy.AlwaysAllowReadWrite()
// }
//
Policy interface {
EvalMutation(context.Context, Mutation) error
EvalQuery(context.Context, Query) error
}
// Schema is the default implementation for the schema Interface.
// It can be embedded in end-user schemas as follows:
//
// type T struct {
// ent.Schema
// }
//
Schema struct {
Interface
}
)
// Fields of the schema.
func (Schema) Fields() []Field { return nil }
// Edges of the schema.
func (Schema) Edges() []Edge { return nil }
// Indexes of the schema.
func (Schema) Indexes() []Index { return nil }
// Config of the schema.
func (Schema) Config() Config { return Config{} }
// Mixin of the schema.
func (Schema) Mixin() []Mixin { return nil }
// Hooks of the schema.
func (Schema) Hooks() []Hook { return nil }
// Policy of the schema.
func (Schema) Policy() Policy { return nil }
// Annotations of the schema.
func (Schema) Annotations() []schema.Annotation { return nil }
type (
// Value represents a value returned by ent.
Value interface{}
// Query represents an ent query builder.
Query interface{}
// Mutation represents an operation that mutate the graph.
// For example, adding a new node, updating many, or dropping
// data. The implementation is generated by entc (ent codegen).
Mutation interface {
// Op returns the operation name generated by entc.
Op() Op
// Type returns the schema type for this mutation.
Type() string
// Fields returns all fields that were changed during
// this mutation. Note that, in order to get all numeric
// fields that were in/decremented, call AddedFields().
Fields() []string
// Field returns the value of a field with the given name.
// The second boolean value indicates that this field was
// not set, or was not defined in the schema.
Field(name string) (Value, bool)
// SetField sets the value for the given name. It returns an
// error if the field is not defined in the schema, or if the
// type mismatch the field type.
SetField(name string, value Value) error
// AddedFields returns all numeric fields that were incremented
// or decremented during this mutation.
AddedFields() []string
// AddedField returns the numeric value that was in/decremented
// from a field with the given name. The second value indicates
// that this field was not set, or was not define in the schema.
AddedField(name string) (Value, bool)
// AddField adds the value for the given name. It returns an
// error if the field is not defined in the schema, or if the
// type mismatch the field type.
AddField(name string, value Value) error
// ClearedFields returns all nullable fields that were cleared
// during this mutation.
ClearedFields() []string
// FieldCleared returns a bool indicates if this field was
// cleared in this mutation.
FieldCleared(name string) bool
// ClearField clears the value for the given name. It returns an
// error if the field is not defined in the schema.
ClearField(name string) error
// ResetField resets all changes in the mutation regarding the
// given field name. It returns an error if the field is not
// defined in the schema.
ResetField(name string) error
// AddedEdges returns all edge names that were set/added in this
// mutation.
AddedEdges() []string
// AddedIDs returns all ids (to other nodes) that were added for
// the given edge name.
AddedIDs(name string) []Value
// RemovedEdges returns all edge names that were removed in this
// mutation.
RemovedEdges() []string
// RemovedIDs returns all ids (to other nodes) that were removed for
// the given edge name.
RemovedIDs(name string) []Value
// ClearedEdges returns all edge names that were cleared in this
// mutation.
ClearedEdges() []string
// EdgeCleared returns a bool indicates if this edge was
// cleared in this mutation.
EdgeCleared(name string) bool
// ClearEdge clears the value for the given name. It returns an
// error if the edge name is not defined in the schema.
ClearEdge(name string) error
// ResetEdge resets all changes in the mutation regarding the
// given edge name. It returns an error if the edge is not
// defined in the schema.
ResetEdge(name string) error
// OldField returns the old value of the field from the database.
// An error is returned if the mutation operation is not UpdateOne,
// or the query to the database was failed.
OldField(ctx context.Context, name string) (Value, error)
}
// Mutator is the interface that wraps the Mutate method.
Mutator interface {
// Mutate apply the given mutation on the graph.
Mutate(context.Context, Mutation) (Value, error)
}
// The MutateFunc type is an adapter to allow the use of ordinary
// function as mutator. If f is a function with the appropriate signature,
// MutateFunc(f) is a Mutator that calls f.
MutateFunc func(context.Context, Mutation) (Value, error)
// Hook defines the "mutation middleware". A function that gets a Mutator
// and returns a Mutator. For example:
//
// hook := func(next ent.Mutator) ent.Mutator {
// return ent.MutateFunc(func(ctx context.Context, m ent.Mutation) (ent.Value, error) {
// fmt.Printf("Type: %s, Operation: %s, ConcreteType: %T\n", m.Type(), m.Op(), m)
// return next.Mutate(ctx, m)
// })
// }
//
Hook func(Mutator) Mutator
)
// Mutate calls f(ctx, m).
func (f MutateFunc) Mutate(ctx context.Context, m Mutation) (Value, error) {
return f(ctx, m)
}
// An Op represents a mutation operation.
type Op uint
// Mutation operations.
const (
OpCreate Op = 1 << iota // node creation.
OpUpdate // update nodes by predicate (if any).
OpUpdateOne // update one node.
OpDelete // delete nodes by predicate (if any).
OpDeleteOne // delete one node.
)
// Is reports whether o is match the given operation.
func (i Op) Is(o Op) bool { return i&o != 0 }
//go:generate go run golang.org/x/tools/cmd/stringer -type Op

43
vendor/entgo.io/ent/op_string.go generated vendored

@ -1,43 +0,0 @@
// Code generated by "stringer -type Op"; DO NOT EDIT.
package ent
import "strconv"
func _() {
// An "invalid array index" compiler error signifies that the constant values have changed.
// Re-run the stringer command to generate them again.
var x [1]struct{}
_ = x[OpCreate-1]
_ = x[OpUpdate-2]
_ = x[OpUpdateOne-4]
_ = x[OpDelete-8]
_ = x[OpDeleteOne-16]
}
const (
_Op_name_0 = "OpCreateOpUpdate"
_Op_name_1 = "OpUpdateOne"
_Op_name_2 = "OpDelete"
_Op_name_3 = "OpDeleteOne"
)
var (
_Op_index_0 = [...]uint8{0, 8, 16}
)
func (i Op) String() string {
switch {
case 1 <= i && i <= 2:
i -= 1
return _Op_name_0[_Op_index_0[i]:_Op_index_0[i+1]]
case i == 4:
return _Op_name_1
case i == 8:
return _Op_name_2
case i == 16:
return _Op_name_3
default:
return "Op(" + strconv.FormatInt(int64(i), 10) + ")"
}
}

@ -1,49 +0,0 @@
// Copyright 2019-present Facebook Inc. All rights reserved.
// This source code is licensed under the Apache 2.0 license found
// in the LICENSE file in the root directory of this source tree.
package edge
import "entgo.io/ent/schema"
// Annotation is a builtin schema annotation for
// configuring the edges' behavior in codegen.
type Annotation struct {
// The StructTag option allows overriding the struct-tag
// of the `Edges` field in the generated entity. For example:
//
// edge.Annotation{
// StructTag: `json: "pet_edges"`
// }
//
StructTag string
}
// Name describes the annotation name.
func (Annotation) Name() string {
return "Edges"
}
// Merge implements the schema.Merger interface.
func (a Annotation) Merge(other schema.Annotation) schema.Annotation {
var ant Annotation
switch other := other.(type) {
case Annotation:
ant = other
case *Annotation:
if other != nil {
ant = *other
}
default:
return a
}
if tag := ant.StructTag; tag != "" {
a.StructTag = tag
}
return a
}
var (
_ schema.Annotation = (*Annotation)(nil)
_ schema.Merger = (*Annotation)(nil)
)

@ -1,270 +0,0 @@
// Copyright 2019-present Facebook Inc. All rights reserved.
// This source code is licensed under the Apache 2.0 license found
// in the LICENSE file in the root directory of this source tree.
package edge
import (
"reflect"
"entgo.io/ent/schema"
)
// A Descriptor for edge configuration.
type Descriptor struct {
Tag string // struct tag.
Type string // edge type.
Name string // edge name.
Field string // edge field name (e.g. foreign-key).
RefName string // ref name; inverse only.
Ref *Descriptor // edge reference; to/from of the same type.
Through *struct{ N, T string } // through type and name.
Unique bool // unique edge.
Inverse bool // inverse edge.
Required bool // required on creation.
StorageKey *StorageKey // optional storage-key configuration.
Annotations []schema.Annotation // edge annotations.
Comment string // edge comment.
}
// To defines an association edge between two vertices.
func To(name string, t interface{}) *assocBuilder {
return &assocBuilder{desc: &Descriptor{Name: name, Type: typ(t)}}
}
// From represents a reversed-edge between two vertices that has a back-reference to its source edge.
func From(name string, t interface{}) *inverseBuilder {
return &inverseBuilder{desc: &Descriptor{Name: name, Type: typ(t), Inverse: true}}
}
func typ(t interface{}) string {
if rt := reflect.TypeOf(t); rt.NumIn() > 0 {
return rt.In(0).Name()
}
return ""
}
// assocBuilder is the builder for assoc edges.
type assocBuilder struct {
desc *Descriptor
}
// Unique sets the edge type to be unique. Basically, it limits the edge to be one of the two:
// one2one or one2many. one2one applied if the inverse-edge is also unique.
func (b *assocBuilder) Unique() *assocBuilder {
b.desc.Unique = true
return b
}
// Required indicates that this edge is a required field on creation.
// Unlike fields, edges are optional by default.
func (b *assocBuilder) Required() *assocBuilder {
b.desc.Required = true
return b
}
// StructTag sets the struct tag of the assoc edge.
func (b *assocBuilder) StructTag(s string) *assocBuilder {
b.desc.Tag = s
return b
}
// From creates an inverse-edge with the same type.
func (b *assocBuilder) From(name string) *inverseBuilder {
return &inverseBuilder{desc: &Descriptor{Name: name, Type: b.desc.Type, Inverse: true, Ref: b.desc}}
}
// Field is used to bind an edge (with a foreign-key) to a field in the schema.
//
// field.Int("owner_id").
// Optional()
//
// edge.To("owner", User.Type).
// Field("owner_id").
// Unique(),
//
func (b *assocBuilder) Field(f string) *assocBuilder {
b.desc.Field = f
return b
}
// Through allows setting an "edge schema" to interact explicitly with M2M edges.
//
// edge.To("friends", User.Type).
// Through("friendships", Friendship.Type)
//
func (b *assocBuilder) Through(name string, t interface{}) *assocBuilder {
b.desc.Through = &struct{ N, T string }{N: name, T: typ(t)}
return b
}
// Comment used to put annotations on the schema.
func (b *assocBuilder) Comment(c string) *assocBuilder {
b.desc.Comment = c
return b
}
// StorageKey sets the storage key of the edge.
//
// edge.To("groups", Group.Type).
// StorageKey(edge.Table("user_groups"), edge.Columns("user_id", "group_id"))
//
func (b *assocBuilder) StorageKey(opts ...StorageOption) *assocBuilder {
if b.desc.StorageKey == nil {
b.desc.StorageKey = &StorageKey{}
}
for i := range opts {
opts[i](b.desc.StorageKey)
}
return b
}
// Annotations adds a list of annotations to the edge object to be used by
// codegen extensions.
//
// edge.To("pets", Pet.Type).
// Annotations(entgql.Bind())
//
func (b *assocBuilder) Annotations(annotations ...schema.Annotation) *assocBuilder {
b.desc.Annotations = append(b.desc.Annotations, annotations...)
return b
}
// Descriptor implements the ent.Descriptor interface.
func (b *assocBuilder) Descriptor() *Descriptor {
return b.desc
}
// inverseBuilder is the builder for inverse edges.
type inverseBuilder struct {
desc *Descriptor
}
// Ref sets the referenced-edge of this inverse edge.
func (b *inverseBuilder) Ref(ref string) *inverseBuilder {
b.desc.RefName = ref
return b
}
// Unique sets the edge type to be unique. Basically, it limits the edge to be one of the two:
// one2one or one2many. one2one applied if the inverse-edge is also unique.
func (b *inverseBuilder) Unique() *inverseBuilder {
b.desc.Unique = true
return b
}
// Required indicates that this edge is a required field on creation.
// Unlike fields, edges are optional by default.
func (b *inverseBuilder) Required() *inverseBuilder {
b.desc.Required = true
return b
}
// StructTag sets the struct tag of the inverse edge.
func (b *inverseBuilder) StructTag(s string) *inverseBuilder {
b.desc.Tag = s
return b
}
// Comment used to put annotations on the schema.
func (b *inverseBuilder) Comment(c string) *inverseBuilder {
b.desc.Comment = c
return b
}
// Field is used to bind an edge (with a foreign-key) to a field in the schema.
//
// field.Int("owner_id").
// Optional()
//
// edge.From("owner", User.Type).
// Ref("pets").
// Field("owner_id").
// Unique(),
//
func (b *inverseBuilder) Field(f string) *inverseBuilder {
b.desc.Field = f
return b
}
// Through allows setting an "edge schema" to interact explicitly with M2M edges.
//
// edge.From("liked_users", User.Type).
// Ref("liked_tweets").
// Through("likes", TweetLike.Type)
//
func (b *inverseBuilder) Through(name string, t interface{}) *inverseBuilder {
b.desc.Through = &struct{ N, T string }{N: name, T: typ(t)}
return b
}
// Annotations adds a list of annotations to the edge object to be used by
// codegen extensions.
//
// edge.From("owner", User.Type).
// Ref("pets").
// Unique().
// Annotations(entgql.Bind())
//
func (b *inverseBuilder) Annotations(annotations ...schema.Annotation) *inverseBuilder {
b.desc.Annotations = append(b.desc.Annotations, annotations...)
return b
}
// Descriptor implements the ent.Descriptor interface.
func (b *inverseBuilder) Descriptor() *Descriptor {
return b.desc
}
// StorageKey holds the configuration for edge storage-key.
type StorageKey struct {
Table string // Table or label.
Symbols []string // Symbols/names of the foreign-key constraints.
Columns []string // Foreign-key columns.
}
// StorageOption allows for setting the storage configuration using functional options.
type StorageOption func(*StorageKey)
// Table sets the table name option for M2M edges.
func Table(name string) StorageOption {
return func(key *StorageKey) {
key.Table = name
}
}
// Symbol sets the symbol/name of the foreign-key constraint for O2O, O2M and M2O edges.
// Note that, for M2M edges (2 columns and 2 constraints), use the edge.Symbols option.
func Symbol(symbol string) StorageOption {
return func(key *StorageKey) {
key.Symbols = []string{symbol}
}
}
// Symbols sets the symbol/name of the foreign-key constraints for M2M edges.
// The 1st column defines the name of the "To" edge, and the 2nd defines
// the name of the "From" edge (inverse edge).
// Note that, for O2O, O2M and M2O edges, use the edge.Symbol option.
func Symbols(to, from string) StorageOption {
return func(key *StorageKey) {
key.Symbols = []string{to, from}
}
}
// Column sets the foreign-key column name option for O2O, O2M and M2O edges.
// Note that, for M2M edges (2 columns), use the edge.Columns option.
func Column(name string) StorageOption {
return func(key *StorageKey) {
key.Columns = []string{name}
}
}
// Columns sets the foreign-key column names option for M2M edges.
// The 1st column defines the name of the "To" edge, and the 2nd defines
// the name of the "From" edge (inverse edge).
// Note that, for O2O, O2M and M2O edges, use the edge.Column option.
func Columns(to, from string) StorageOption {
return func(key *StorageKey) {
key.Columns = []string{to, from}
}
}

@ -1,81 +0,0 @@
// Copyright 2019-present Facebook Inc. All rights reserved.
// This source code is licensed under the Apache 2.0 license found
// in the LICENSE file in the root directory of this source tree.
package field
import "entgo.io/ent/schema"
// Annotation is a builtin schema annotation for
// configuring the schema fields in codegen.
type Annotation struct {
// The StructTag option allows overriding the struct-tag
// of the fields in the generated entity. For example:
//
// field.Annotation{
// StructTag: map[string]string{
// "id": `json:"id,omitempty" yaml:"-"`,
// },
// }
//
StructTag map[string]string
// ID defines a multi-field schema identifier. Note,
// the annotation is valid only for edge schemas.
//
// func (TweetLike) Annotations() []schema.Annotation {
// return []schema.Annotation{
// field.ID("user_id", "tweet_id"),
// }
// }
//
ID []string
}
// ID defines a multi-field schema identifier. Note, the
// annotation is valid only for edge schemas.
//
// func (TweetLike) Annotations() []schema.Annotation {
// return []schema.Annotation{
// field.ID("user_id", "tweet_id"),
// }
// }
//
func ID(first, second string, fields ...string) *Annotation {
return &Annotation{ID: append([]string{first, second}, fields...)}
}
// Name describes the annotation name.
func (Annotation) Name() string {
return "Fields"
}
// Merge implements the schema.Merger interface.
func (a Annotation) Merge(other schema.Annotation) schema.Annotation {
var ant Annotation
switch other := other.(type) {
case Annotation:
ant = other
case *Annotation:
if other != nil {
ant = *other
}
default:
return a
}
for k, v := range ant.StructTag {
if a.StructTag == nil {
a.StructTag = make(map[string]string)
}
a.StructTag[k] = v
}
if len(ant.ID) > 0 {
a.ID = ant.ID
}
return a
}
var _ interface {
schema.Annotation
schema.Merger
} = (*Annotation)(nil)

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

@ -1,244 +0,0 @@
// Copyright 2019-present Facebook Inc. All rights reserved.
// This source code is licensed under the Apache 2.0 license found
// in the LICENSE file in the root directory of this source tree.
package field
import (
"fmt"
"reflect"
"strings"
)
// A Type represents a field type.
type Type uint8
// List of field types.
const (
TypeInvalid Type = iota
TypeBool
TypeTime
TypeJSON
TypeUUID
TypeBytes
TypeEnum
TypeString
TypeOther
TypeInt8
TypeInt16
TypeInt32
TypeInt
TypeInt64
TypeUint8
TypeUint16
TypeUint32
TypeUint
TypeUint64
TypeFloat32
TypeFloat64
endTypes
)
// String returns the string representation of a type.
func (t Type) String() string {
if t < endTypes {
return typeNames[t]
}
return typeNames[TypeInvalid]
}
// Numeric reports if the given type is a numeric type.
func (t Type) Numeric() bool {
return t >= TypeInt8 && t < endTypes
}
// Float reports if the given type is a float type.
func (t Type) Float() bool {
return t == TypeFloat32 || t == TypeFloat64
}
// Integer reports if the given type is an integral type.
func (t Type) Integer() bool {
return t.Numeric() && !t.Float()
}
// Valid reports if the given type if known type.
func (t Type) Valid() bool {
return t > TypeInvalid && t < endTypes
}
// ConstName returns the constant name of an info type.
// It's used by entc for printing the constant name in templates.
func (t Type) ConstName() string {
switch {
case !t.Valid():
return typeNames[TypeInvalid]
case int(t) < len(constNames) && constNames[t] != "":
return constNames[t]
default:
return "Type" + strings.Title(typeNames[t])
}
}
// TypeInfo holds the information regarding field type.
// Used by complex types like JSON and Bytes.
type TypeInfo struct {
Type Type
Ident string
PkgPath string // import path.
PkgName string // local package name.
Nillable bool // slices or pointers.
RType *RType
}
// String returns the string representation of a type.
func (t TypeInfo) String() string {
switch {
case t.Ident != "":
return t.Ident
case t.Type < endTypes:
return typeNames[t.Type]
default:
return typeNames[TypeInvalid]
}
}
// Valid reports if the given type if known type.
func (t TypeInfo) Valid() bool {
return t.Type.Valid()
}
// Numeric reports if the given type is a numeric type.
func (t TypeInfo) Numeric() bool {
return t.Type.Numeric()
}
// ConstName returns the const name of the info type.
func (t TypeInfo) ConstName() string {
return t.Type.ConstName()
}
// ValueScanner indicates if this type implements the ValueScanner interface.
func (t TypeInfo) ValueScanner() bool {
return t.RType.Implements(valueScannerType)
}
// Valuer indicates if this type implements the driver.Valuer interface.
func (t TypeInfo) Valuer() bool {
return t.RType.Implements(valuerType)
}
// Comparable reports whether values of this type are comparable.
func (t TypeInfo) Comparable() bool {
switch t.Type {
case TypeBool, TypeTime, TypeUUID, TypeEnum, TypeString:
return true
case TypeOther:
// Always accept custom types as comparable on the database side.
// In the future, we should consider adding an interface to let
// custom types tell if they are comparable or not (see #1304).
return true
default:
return t.Numeric()
}
}
var stringerType = reflect.TypeOf((*fmt.Stringer)(nil)).Elem()
// Stringer indicates if this type implements the Stringer interface.
func (t TypeInfo) Stringer() bool {
return t.RType.Implements(stringerType)
}
var (
typeNames = [...]string{
TypeInvalid: "invalid",
TypeBool: "bool",
TypeTime: "time.Time",
TypeJSON: "json.RawMessage",
TypeUUID: "[16]byte",
TypeBytes: "[]byte",
TypeEnum: "string",
TypeString: "string",
TypeOther: "other",
TypeInt: "int",
TypeInt8: "int8",
TypeInt16: "int16",
TypeInt32: "int32",
TypeInt64: "int64",
TypeUint: "uint",
TypeUint8: "uint8",
TypeUint16: "uint16",
TypeUint32: "uint32",
TypeUint64: "uint64",
TypeFloat32: "float32",
TypeFloat64: "float64",
}
constNames = [...]string{
TypeJSON: "TypeJSON",
TypeUUID: "TypeUUID",
TypeTime: "TypeTime",
TypeEnum: "TypeEnum",
TypeBytes: "TypeBytes",
TypeOther: "TypeOther",
}
)
// RType holds a serializable reflect.Type information of
// Go object. Used by the entc package.
type RType struct {
Name string // reflect.Type.Name
Ident string // reflect.Type.String
Kind reflect.Kind
PkgPath string
Methods map[string]struct{ In, Out []*RType }
// Used only for in-package checks.
rtype reflect.Type
}
// TypeEqual reports if the underlying type is equal to the RType (after pointer indirections).
func (r *RType) TypeEqual(t reflect.Type) bool {
tv := indirect(t)
return r.Name == tv.Name() && r.Kind == t.Kind() && r.PkgPath == tv.PkgPath()
}
// RType returns the string value of the indirect reflect.Type.
func (r *RType) String() string {
if r.rtype != nil {
return r.rtype.String()
}
return r.Ident
}
// IsPtr reports if the reflect-type is a pointer type.
func (r *RType) IsPtr() bool {
return r != nil && r.Kind == reflect.Ptr
}
// Implements reports whether the RType ~implements the given interface type.
func (r *RType) Implements(typ reflect.Type) bool {
if r == nil {
return false
}
n := typ.NumMethod()
for i := 0; i < n; i++ {
m0 := typ.Method(i)
m1, ok := r.Methods[m0.Name]
if !ok || len(m1.In) != m0.Type.NumIn() || len(m1.Out) != m0.Type.NumOut() {
return false
}
in := m0.Type.NumIn()
for j := 0; j < in; j++ {
if !m1.In[j].TypeEqual(m0.Type.In(j)) {
return false
}
}
out := m0.Type.NumOut()
for j := 0; j < out; j++ {
if !m1.Out[j].TypeEqual(m0.Type.Out(j)) {
return false
}
}
}
return true
}

@ -1,121 +0,0 @@
// Copyright 2019-present Facebook Inc. All rights reserved.
// This source code is licensed under the Apache 2.0 license found
// in the LICENSE file in the root directory of this source tree.
package index
import "entgo.io/ent/schema"
// A Descriptor for index configuration.
type Descriptor struct {
Unique bool // unique index.
Edges []string // edge columns.
Fields []string // field columns.
StorageKey string // custom index name.
Annotations []schema.Annotation // index annotations.
}
// Builder for indexes on vertex columns and edges in the graph.
type Builder struct {
desc *Descriptor
}
// Fields creates an index on the given vertex fields.
// Note that indexes are implemented only for SQL dialects, and does not support gremlin.
//
// func (T) Indexes() []ent.Index {
//
// // Unique index on 2 fields.
// index.Fields("first", "last").
// Unique(),
//
// // Unique index of field under specific edge.
// index.Fields("name").
// Edges("parent").
// Unique(),
//
// }
//
func Fields(fields ...string) *Builder {
return &Builder{desc: &Descriptor{Fields: fields}}
}
// Edges creates an index on the given vertex edge fields.
// Note that indexes are implemented only for SQL dialects, and does not support gremlin.
//
// func (T) Indexes() []ent.Index {
//
// // Unique index of field under 2 edges.
// index.Fields("name").
// Edges("parent", "type").
// Unique(),
//
// }
//
func Edges(edges ...string) *Builder {
return &Builder{desc: &Descriptor{Edges: edges}}
}
// Fields sets the fields of the index.
//
// func (T) Indexes() []ent.Index {
//
// // Unique "name" and "age" fields under the "parent" edge.
// index.Edges("parent").
// Fields("name", "age").
// Unique(),
//
// }
func (b *Builder) Fields(fields ...string) *Builder {
b.desc.Fields = fields
return b
}
// Edges sets the fields index to be unique under the set of edges (sub-graph). For example:
//
// func (T) Indexes() []ent.Index {
//
// // Unique "name" field under the "parent" edge.
// index.Fields("name").
// Edges("parent").
// Unique(),
// }
//
func (b *Builder) Edges(edges ...string) *Builder {
b.desc.Edges = edges
return b
}
// Unique sets the index to be a unique index.
// Note that defining a uniqueness on optional fields won't prevent
// duplicates if one of the column contains NULL values.
func (b *Builder) Unique() *Builder {
b.desc.Unique = true
return b
}
// StorageKey sets the storage key of the index. In SQL dialects, it's the index name.
func (b *Builder) StorageKey(key string) *Builder {
b.desc.StorageKey = key
return b
}
// Annotations adds a list of annotations to the index object to be used by codegen extensions.
//
// func (T) Indexes() []ent.Index {
//
// // Partial index on name where the entity is not deleted.
// index.Fields("name").
// Annotations(entsql.Prefix(100))
//
// }
//
func (b *Builder) Annotations(annotations ...schema.Annotation) *Builder {
b.desc.Annotations = append(b.desc.Annotations, annotations...)
return b
}
// Descriptor implements the ent.Descriptor interface.
func (b *Builder) Descriptor() *Descriptor {
return b.desc
}

@ -1,24 +0,0 @@
// Copyright 2019-present Facebook Inc. All rights reserved.
// This source code is licensed under the Apache 2.0 license found
// in the LICENSE file in the root directory of this source tree.
package schema
// Annotation is used to attach arbitrary metadata to the schema objects in codegen.
// The object must be serializable to JSON raw value (e.g. struct, map or slice).
//
// Template extensions can retrieve this metadata and use it inside their templates.
// Read more about it in ent website: https://entgo.io/docs/templates/#annotations.
type Annotation interface {
// Name defines the name of the annotation to be retrieved by the codegen.
Name() string
}
// Merger wraps the single Merge function allows custom annotation to provide
// an implementation for merging 2 or more annotations from the same type.
//
// A common use case is where the same Annotation type is defined both in
// mixin.Schema and ent.Schema.
type Merger interface {
Merge(Annotation) Annotation
}

@ -1,10 +1,3 @@
# entgo.io/ent v0.11.1
## explicit; go 1.17
entgo.io/ent
entgo.io/ent/schema
entgo.io/ent/schema/edge
entgo.io/ent/schema/field
entgo.io/ent/schema/index
# gitee.com/chunanyong/dm v1.8.5
## explicit; go 1.13
gitee.com/chunanyong/dm

Loading…
Cancel
Save