github.com/octohelm/storage@v0.0.0-20240516030302-1ac2cc1ea347/testdata/model/zz_generated.table.go (about)

     1  /*
     2  Package model GENERATED BY gengo:table
     3  DON'T EDIT THIS FILE
     4  */
     5  package model
     6  
     7  import (
     8  	context "context"
     9  
    10  	github_com_octohelm_storage_pkg_datatypes "github.com/octohelm/storage/pkg/datatypes"
    11  	github_com_octohelm_storage_pkg_sqlbuilder "github.com/octohelm/storage/pkg/sqlbuilder"
    12  )
    13  
    14  func (Org) TableName() string {
    15  	return "t_org"
    16  }
    17  
    18  func (Org) Primary() []string {
    19  	return []string{
    20  		"ID",
    21  	}
    22  }
    23  
    24  func (Org) UniqueIndexes() github_com_octohelm_storage_pkg_sqlbuilder.Indexes {
    25  	return github_com_octohelm_storage_pkg_sqlbuilder.Indexes{
    26  		"i_name": []string{
    27  			"Name",
    28  		},
    29  	}
    30  }
    31  
    32  func (Org) Indexes() github_com_octohelm_storage_pkg_sqlbuilder.Indexes {
    33  	return github_com_octohelm_storage_pkg_sqlbuilder.Indexes{
    34  		"i_created_at": []string{
    35  			"CreatedAt",
    36  		},
    37  	}
    38  }
    39  
    40  func (tableOrg) New() github_com_octohelm_storage_pkg_sqlbuilder.Model {
    41  	return &Org{}
    42  }
    43  
    44  func (t *tableOrg) IsNil() bool {
    45  	return t.table.IsNil()
    46  }
    47  
    48  func (t *tableOrg) Ex(ctx context.Context) *github_com_octohelm_storage_pkg_sqlbuilder.Ex {
    49  	return t.table.Ex(ctx)
    50  }
    51  
    52  func (t *tableOrg) TableName() string {
    53  	return t.table.TableName()
    54  }
    55  
    56  func (t *tableOrg) F(name string) github_com_octohelm_storage_pkg_sqlbuilder.Column {
    57  	return t.table.F(name)
    58  }
    59  
    60  func (t *tableOrg) K(name string) github_com_octohelm_storage_pkg_sqlbuilder.Key {
    61  	return t.table.K(name)
    62  }
    63  
    64  func (t *tableOrg) Cols(names ...string) github_com_octohelm_storage_pkg_sqlbuilder.ColumnCollection {
    65  	return t.table.Cols(names...)
    66  }
    67  
    68  func (t *tableOrg) Keys(names ...string) github_com_octohelm_storage_pkg_sqlbuilder.KeyCollection {
    69  	return t.table.Keys(names...)
    70  }
    71  
    72  type tableOrg struct {
    73  	I         indexNameOfOrg
    74  	table     github_com_octohelm_storage_pkg_sqlbuilder.Table
    75  	ID        github_com_octohelm_storage_pkg_sqlbuilder.TypedColumn[uint64]
    76  	Name      github_com_octohelm_storage_pkg_sqlbuilder.TypedColumn[string]
    77  	CreatedAt github_com_octohelm_storage_pkg_sqlbuilder.TypedColumn[github_com_octohelm_storage_pkg_datatypes.Datetime]
    78  	UpdatedAt github_com_octohelm_storage_pkg_sqlbuilder.TypedColumn[int64]
    79  	DeletedAt github_com_octohelm_storage_pkg_sqlbuilder.TypedColumn[int64]
    80  }
    81  
    82  type indexNameOfOrg struct {
    83  	Primary github_com_octohelm_storage_pkg_sqlbuilder.ColumnCollection
    84  	IName   github_com_octohelm_storage_pkg_sqlbuilder.ColumnCollection
    85  }
    86  
    87  var OrgT = &tableOrg{
    88  	ID:        github_com_octohelm_storage_pkg_sqlbuilder.CastCol[uint64](github_com_octohelm_storage_pkg_sqlbuilder.TableFromModel(&Org{}).F("ID")),
    89  	Name:      github_com_octohelm_storage_pkg_sqlbuilder.CastCol[string](github_com_octohelm_storage_pkg_sqlbuilder.TableFromModel(&Org{}).F("Name")),
    90  	CreatedAt: github_com_octohelm_storage_pkg_sqlbuilder.CastCol[github_com_octohelm_storage_pkg_datatypes.Datetime](github_com_octohelm_storage_pkg_sqlbuilder.TableFromModel(&Org{}).F("CreatedAt")),
    91  	UpdatedAt: github_com_octohelm_storage_pkg_sqlbuilder.CastCol[int64](github_com_octohelm_storage_pkg_sqlbuilder.TableFromModel(&Org{}).F("UpdatedAt")),
    92  	DeletedAt: github_com_octohelm_storage_pkg_sqlbuilder.CastCol[int64](github_com_octohelm_storage_pkg_sqlbuilder.TableFromModel(&Org{}).F("DeletedAt")),
    93  
    94  	I: indexNameOfOrg{
    95  		Primary: github_com_octohelm_storage_pkg_sqlbuilder.TableFromModel(&Org{}).Cols([]string{
    96  			"ID",
    97  		}...),
    98  		IName: github_com_octohelm_storage_pkg_sqlbuilder.TableFromModel(&Org{}).Cols([]string{
    99  			"Name",
   100  		}...),
   101  	},
   102  	table: github_com_octohelm_storage_pkg_sqlbuilder.TableFromModel(&Org{}),
   103  }
   104  
   105  func (OrgUser) TableName() string {
   106  	return "t_org_user"
   107  }
   108  
   109  func (OrgUser) Primary() []string {
   110  	return []string{
   111  		"ID",
   112  	}
   113  }
   114  
   115  func (OrgUser) UniqueIndexes() github_com_octohelm_storage_pkg_sqlbuilder.Indexes {
   116  	return github_com_octohelm_storage_pkg_sqlbuilder.Indexes{
   117  		"i_org_usr": []string{
   118  			"UserID",
   119  			"OrgID",
   120  		},
   121  	}
   122  }
   123  
   124  func (tableOrgUser) New() github_com_octohelm_storage_pkg_sqlbuilder.Model {
   125  	return &OrgUser{}
   126  }
   127  
   128  func (t *tableOrgUser) IsNil() bool {
   129  	return t.table.IsNil()
   130  }
   131  
   132  func (t *tableOrgUser) Ex(ctx context.Context) *github_com_octohelm_storage_pkg_sqlbuilder.Ex {
   133  	return t.table.Ex(ctx)
   134  }
   135  
   136  func (t *tableOrgUser) TableName() string {
   137  	return t.table.TableName()
   138  }
   139  
   140  func (t *tableOrgUser) F(name string) github_com_octohelm_storage_pkg_sqlbuilder.Column {
   141  	return t.table.F(name)
   142  }
   143  
   144  func (t *tableOrgUser) K(name string) github_com_octohelm_storage_pkg_sqlbuilder.Key {
   145  	return t.table.K(name)
   146  }
   147  
   148  func (t *tableOrgUser) Cols(names ...string) github_com_octohelm_storage_pkg_sqlbuilder.ColumnCollection {
   149  	return t.table.Cols(names...)
   150  }
   151  
   152  func (t *tableOrgUser) Keys(names ...string) github_com_octohelm_storage_pkg_sqlbuilder.KeyCollection {
   153  	return t.table.Keys(names...)
   154  }
   155  
   156  type tableOrgUser struct {
   157  	I      indexNameOfOrgUser
   158  	table  github_com_octohelm_storage_pkg_sqlbuilder.Table
   159  	ID     github_com_octohelm_storage_pkg_sqlbuilder.TypedColumn[uint64]
   160  	UserID github_com_octohelm_storage_pkg_sqlbuilder.TypedColumn[uint64]
   161  	OrgID  github_com_octohelm_storage_pkg_sqlbuilder.TypedColumn[uint64]
   162  }
   163  
   164  type indexNameOfOrgUser struct {
   165  	Primary github_com_octohelm_storage_pkg_sqlbuilder.ColumnCollection
   166  	IOrgUsr github_com_octohelm_storage_pkg_sqlbuilder.ColumnCollection
   167  }
   168  
   169  var OrgUserT = &tableOrgUser{
   170  	ID:     github_com_octohelm_storage_pkg_sqlbuilder.CastCol[uint64](github_com_octohelm_storage_pkg_sqlbuilder.TableFromModel(&OrgUser{}).F("ID")),
   171  	UserID: github_com_octohelm_storage_pkg_sqlbuilder.CastCol[uint64](github_com_octohelm_storage_pkg_sqlbuilder.TableFromModel(&OrgUser{}).F("UserID")),
   172  	OrgID:  github_com_octohelm_storage_pkg_sqlbuilder.CastCol[uint64](github_com_octohelm_storage_pkg_sqlbuilder.TableFromModel(&OrgUser{}).F("OrgID")),
   173  
   174  	I: indexNameOfOrgUser{
   175  		Primary: github_com_octohelm_storage_pkg_sqlbuilder.TableFromModel(&OrgUser{}).Cols([]string{
   176  			"ID",
   177  		}...),
   178  		IOrgUsr: github_com_octohelm_storage_pkg_sqlbuilder.TableFromModel(&OrgUser{}).Cols([]string{
   179  			"UserID",
   180  			"OrgID",
   181  		}...),
   182  	},
   183  	table: github_com_octohelm_storage_pkg_sqlbuilder.TableFromModel(&OrgUser{}),
   184  }
   185  
   186  func (User) TableName() string {
   187  	return "t_user"
   188  }
   189  
   190  func (User) Primary() []string {
   191  	return []string{
   192  		"ID",
   193  	}
   194  }
   195  
   196  func (User) UniqueIndexes() github_com_octohelm_storage_pkg_sqlbuilder.Indexes {
   197  	return github_com_octohelm_storage_pkg_sqlbuilder.Indexes{
   198  		"i_age": []string{
   199  			"Age",
   200  			"DeletedAt",
   201  		},
   202  		"i_name": []string{
   203  			"Name",
   204  			"DeletedAt",
   205  		},
   206  	}
   207  }
   208  
   209  func (User) Indexes() github_com_octohelm_storage_pkg_sqlbuilder.Indexes {
   210  	return github_com_octohelm_storage_pkg_sqlbuilder.Indexes{
   211  		"i_created_at": []string{
   212  			"CreatedAt",
   213  		},
   214  		"i_nickname": []string{
   215  			"Nickname",
   216  		},
   217  	}
   218  }
   219  
   220  func (tableUser) New() github_com_octohelm_storage_pkg_sqlbuilder.Model {
   221  	return &User{}
   222  }
   223  
   224  func (t *tableUser) IsNil() bool {
   225  	return t.table.IsNil()
   226  }
   227  
   228  func (t *tableUser) Ex(ctx context.Context) *github_com_octohelm_storage_pkg_sqlbuilder.Ex {
   229  	return t.table.Ex(ctx)
   230  }
   231  
   232  func (t *tableUser) TableName() string {
   233  	return t.table.TableName()
   234  }
   235  
   236  func (t *tableUser) F(name string) github_com_octohelm_storage_pkg_sqlbuilder.Column {
   237  	return t.table.F(name)
   238  }
   239  
   240  func (t *tableUser) K(name string) github_com_octohelm_storage_pkg_sqlbuilder.Key {
   241  	return t.table.K(name)
   242  }
   243  
   244  func (t *tableUser) Cols(names ...string) github_com_octohelm_storage_pkg_sqlbuilder.ColumnCollection {
   245  	return t.table.Cols(names...)
   246  }
   247  
   248  func (t *tableUser) Keys(names ...string) github_com_octohelm_storage_pkg_sqlbuilder.KeyCollection {
   249  	return t.table.Keys(names...)
   250  }
   251  
   252  type tableUser struct {
   253  	I         indexNameOfUser
   254  	table     github_com_octohelm_storage_pkg_sqlbuilder.Table
   255  	ID        github_com_octohelm_storage_pkg_sqlbuilder.TypedColumn[uint64]
   256  	Name      github_com_octohelm_storage_pkg_sqlbuilder.TypedColumn[string]
   257  	Nickname  github_com_octohelm_storage_pkg_sqlbuilder.TypedColumn[string]
   258  	Username  github_com_octohelm_storage_pkg_sqlbuilder.TypedColumn[string]
   259  	Gender    github_com_octohelm_storage_pkg_sqlbuilder.TypedColumn[Gender]
   260  	Age       github_com_octohelm_storage_pkg_sqlbuilder.TypedColumn[int64]
   261  	CreatedAt github_com_octohelm_storage_pkg_sqlbuilder.TypedColumn[github_com_octohelm_storage_pkg_datatypes.Datetime]
   262  	UpdatedAt github_com_octohelm_storage_pkg_sqlbuilder.TypedColumn[int64]
   263  	DeletedAt github_com_octohelm_storage_pkg_sqlbuilder.TypedColumn[int64]
   264  }
   265  
   266  type indexNameOfUser struct {
   267  	Primary github_com_octohelm_storage_pkg_sqlbuilder.ColumnCollection
   268  	IName   github_com_octohelm_storage_pkg_sqlbuilder.ColumnCollection
   269  	IAge    github_com_octohelm_storage_pkg_sqlbuilder.ColumnCollection
   270  }
   271  
   272  var UserT = &tableUser{
   273  	ID:        github_com_octohelm_storage_pkg_sqlbuilder.CastCol[uint64](github_com_octohelm_storage_pkg_sqlbuilder.TableFromModel(&User{}).F("ID")),
   274  	Name:      github_com_octohelm_storage_pkg_sqlbuilder.CastCol[string](github_com_octohelm_storage_pkg_sqlbuilder.TableFromModel(&User{}).F("Name")),
   275  	Nickname:  github_com_octohelm_storage_pkg_sqlbuilder.CastCol[string](github_com_octohelm_storage_pkg_sqlbuilder.TableFromModel(&User{}).F("Nickname")),
   276  	Username:  github_com_octohelm_storage_pkg_sqlbuilder.CastCol[string](github_com_octohelm_storage_pkg_sqlbuilder.TableFromModel(&User{}).F("Username")),
   277  	Gender:    github_com_octohelm_storage_pkg_sqlbuilder.CastCol[Gender](github_com_octohelm_storage_pkg_sqlbuilder.TableFromModel(&User{}).F("Gender")),
   278  	Age:       github_com_octohelm_storage_pkg_sqlbuilder.CastCol[int64](github_com_octohelm_storage_pkg_sqlbuilder.TableFromModel(&User{}).F("Age")),
   279  	CreatedAt: github_com_octohelm_storage_pkg_sqlbuilder.CastCol[github_com_octohelm_storage_pkg_datatypes.Datetime](github_com_octohelm_storage_pkg_sqlbuilder.TableFromModel(&User{}).F("CreatedAt")),
   280  	UpdatedAt: github_com_octohelm_storage_pkg_sqlbuilder.CastCol[int64](github_com_octohelm_storage_pkg_sqlbuilder.TableFromModel(&User{}).F("UpdatedAt")),
   281  	DeletedAt: github_com_octohelm_storage_pkg_sqlbuilder.CastCol[int64](github_com_octohelm_storage_pkg_sqlbuilder.TableFromModel(&User{}).F("DeletedAt")),
   282  
   283  	I: indexNameOfUser{
   284  		Primary: github_com_octohelm_storage_pkg_sqlbuilder.TableFromModel(&User{}).Cols([]string{
   285  			"ID",
   286  		}...),
   287  		IName: github_com_octohelm_storage_pkg_sqlbuilder.TableFromModel(&User{}).Cols([]string{
   288  			"Name",
   289  			"DeletedAt",
   290  		}...),
   291  		IAge: github_com_octohelm_storage_pkg_sqlbuilder.TableFromModel(&User{}).Cols([]string{
   292  			"Age",
   293  			"DeletedAt",
   294  		}...),
   295  	},
   296  	table: github_com_octohelm_storage_pkg_sqlbuilder.TableFromModel(&User{}),
   297  }