package domain64 import ( "database/sql" "sync" "github.com/jpillora/go-tld" ) type Domain64Map struct { mu sync.Mutex m map[string]int DB *sql.DB Flushed bool } // Just use the D64 values. // TLD :: 0-255 // TLD.Domain :: FF:FFFFFF or some range of ints // TLD.DOMAIN.SUBDOMAIN :: FF:FFFFFF:FF (bigger ints) // now it is just a map // https://stackoverflow.com/questions/40568759/sqlite-query-integer-field-based-on-a-bit func NewDomain64Map(db *sql.DB) (*Domain64Map, error) { d64m := &Domain64Map{} d64m.DB = db d64m.Flushed = true // Init the tables if a DB pointer is passed in. return d64m, nil } func (d64m *Domain64Map) Insert(url string) { _, err := tld.Parse(url) if err != nil { // TODO panic(err) } // If we have this TLD, return the value for it. }