| 
									
										
										
										
											2024-09-14 20:37:51 -05:00
										 |  |  | package sqlite | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | import ( | 
					
						
							| 
									
										
										
										
											2024-10-28 13:48:22 -05:00
										 |  |  | 	"codeberg.org/danjones000/combluotion/config" | 
					
						
							|  |  |  | 	"codeberg.org/danjones000/combluotion/store" | 
					
						
							| 
									
										
										
										
											2024-09-14 20:37:51 -05:00
										 |  |  | 	"github.com/go-ap/storage-sqlite" | 
					
						
							|  |  |  | ) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | func init() { | 
					
						
							|  |  |  | 	store.AddFactory("sqlite", MakeStore) | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-01-26 20:07:45 -06:00
										 |  |  | type settings struct { | 
					
						
							|  |  |  | 	Path string | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | func MakeStore(conf config.Store) (store.Store, error) { | 
					
						
							|  |  |  | 	var s settings | 
					
						
							|  |  |  | 	err := conf.Decode(&s) | 
					
						
							|  |  |  | 	if err != nil { | 
					
						
							|  |  |  | 		return nil, err | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 	sqlConf := sqlite.Config{Path: s.Path} | 
					
						
							| 
									
										
										
										
											2024-09-14 20:37:51 -05:00
										 |  |  | 	db, err := sqlite.New(sqlConf) | 
					
						
							|  |  |  | 	if err != nil { | 
					
						
							|  |  |  | 		return nil, err | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 	return Repo{db}, nil | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | type Repo struct { | 
					
						
							|  |  |  | 	store.PartStore | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | func (r Repo) Bootstrap(config.Config) error { | 
					
						
							|  |  |  | 	// @todo | 
					
						
							|  |  |  | 	return nil | 
					
						
							|  |  |  | } |