github.com/klaytn/klaytn@v1.12.1/datasync/dbsyncer/gen_config.go (about) 1 // Code generated by github.com/fjl/gencodec. DO NOT EDIT. 2 3 package dbsyncer 4 5 import ( 6 "time" 7 ) 8 9 // MarshalTOML marshals as TOML. 10 func (d DBConfig) MarshalTOML() (interface{}, error) { 11 type DBConfig struct { 12 EnabledDBSyncer bool 13 EnabledLogMode bool 14 DBHost string `toml:",omitempty"` 15 DBPort string `toml:",omitempty"` 16 DBUser string `toml:",omitempty"` 17 DBPassword string `toml:",omitempty"` 18 DBName string `toml:",omitempty"` 19 MaxIdleConns int `toml:",omitempty"` 20 MaxOpenConns int `toml:",omitempty"` 21 ConnMaxLifetime time.Duration `toml:",omitempty"` 22 BlockChannelSize int `toml:",omitempty"` 23 GenQueryThread int `toml:",omitempty"` 24 InsertThread int `toml:",omitempty"` 25 BulkInsertSize int `toml:",omitempty"` 26 Mode string `toml:",omitempty"` 27 EventMode string `toml:",omitempty"` 28 MaxBlockDiff uint64 `toml:",omitempty"` 29 } 30 var enc DBConfig 31 enc.EnabledDBSyncer = d.EnabledDBSyncer 32 enc.EnabledLogMode = d.EnabledLogMode 33 enc.DBHost = d.DBHost 34 enc.DBPort = d.DBPort 35 enc.DBUser = d.DBUser 36 enc.DBPassword = d.DBPassword 37 enc.DBName = d.DBName 38 enc.MaxIdleConns = d.MaxIdleConns 39 enc.MaxOpenConns = d.MaxOpenConns 40 enc.ConnMaxLifetime = d.ConnMaxLifetime 41 enc.BlockChannelSize = d.BlockChannelSize 42 enc.GenQueryThread = d.GenQueryThread 43 enc.InsertThread = d.InsertThread 44 enc.BulkInsertSize = d.BulkInsertSize 45 enc.Mode = d.Mode 46 enc.EventMode = d.EventMode 47 enc.MaxBlockDiff = d.MaxBlockDiff 48 return &enc, nil 49 } 50 51 // UnmarshalTOML unmarshals from TOML. 52 func (d *DBConfig) UnmarshalTOML(unmarshal func(interface{}) error) error { 53 type DBConfig struct { 54 EnabledDBSyncer *bool 55 EnabledLogMode *bool 56 DBHost *string `toml:",omitempty"` 57 DBPort *string `toml:",omitempty"` 58 DBUser *string `toml:",omitempty"` 59 DBPassword *string `toml:",omitempty"` 60 DBName *string `toml:",omitempty"` 61 MaxIdleConns *int `toml:",omitempty"` 62 MaxOpenConns *int `toml:",omitempty"` 63 ConnMaxLifetime *time.Duration `toml:",omitempty"` 64 BlockChannelSize *int `toml:",omitempty"` 65 GenQueryThread *int `toml:",omitempty"` 66 InsertThread *int `toml:",omitempty"` 67 BulkInsertSize *int `toml:",omitempty"` 68 Mode *string `toml:",omitempty"` 69 EventMode *string `toml:",omitempty"` 70 MaxBlockDiff *uint64 `toml:",omitempty"` 71 } 72 var dec DBConfig 73 if err := unmarshal(&dec); err != nil { 74 return err 75 } 76 if dec.EnabledDBSyncer != nil { 77 d.EnabledDBSyncer = *dec.EnabledDBSyncer 78 } 79 if dec.EnabledLogMode != nil { 80 d.EnabledLogMode = *dec.EnabledLogMode 81 } 82 if dec.DBHost != nil { 83 d.DBHost = *dec.DBHost 84 } 85 if dec.DBPort != nil { 86 d.DBPort = *dec.DBPort 87 } 88 if dec.DBUser != nil { 89 d.DBUser = *dec.DBUser 90 } 91 if dec.DBPassword != nil { 92 d.DBPassword = *dec.DBPassword 93 } 94 if dec.DBName != nil { 95 d.DBName = *dec.DBName 96 } 97 if dec.MaxIdleConns != nil { 98 d.MaxIdleConns = *dec.MaxIdleConns 99 } 100 if dec.MaxOpenConns != nil { 101 d.MaxOpenConns = *dec.MaxOpenConns 102 } 103 if dec.ConnMaxLifetime != nil { 104 d.ConnMaxLifetime = *dec.ConnMaxLifetime 105 } 106 if dec.BlockChannelSize != nil { 107 d.BlockChannelSize = *dec.BlockChannelSize 108 } 109 if dec.GenQueryThread != nil { 110 d.GenQueryThread = *dec.GenQueryThread 111 } 112 if dec.InsertThread != nil { 113 d.InsertThread = *dec.InsertThread 114 } 115 if dec.BulkInsertSize != nil { 116 d.BulkInsertSize = *dec.BulkInsertSize 117 } 118 if dec.Mode != nil { 119 d.Mode = *dec.Mode 120 } 121 if dec.EventMode != nil { 122 d.EventMode = *dec.EventMode 123 } 124 if dec.MaxBlockDiff != nil { 125 d.MaxBlockDiff = *dec.MaxBlockDiff 126 } 127 return nil 128 }